use thiserror::Error;

#[derive(Error, Debug)]
pub enum KanbanError {
    #[error("Connection error: {0}")]
    Connection(String),

    #[error("Not found: {0}")]
    NotFound(String),

    #[error("Validation error: {0}")]
    Validation(String),

    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),

    #[error("Serialization error: {0}")]
    Serialization(String),

    #[error("Internal error: {0}")]
    Internal(String),

    #[error("File conflict: {path} was modified by another instance")]
    ConflictDetected {
        path: String,
        #[source]
        source: Option<Box<dyn std::error::Error + Send + Sync>>,
    },

    #[error("Cycle detected: adding this edge would create a circular dependency")]
    CycleDetected,

    #[error("Self-reference not allowed")]
    SelfReference,

    #[error("Edge not found")]
    EdgeNotFound,
}
