use thiserror::Error;

/// Result type for K4000 operations
pub type K4000Result<T> = Result<T, K4000Error>;

/// Errors that can occur in K4000
#[derive(Debug, Error)]
pub enum K4000Error {
    /// Task not found
    #[error("Task not found: {0}")]
    TaskNotFound(String),

    /// Review session not found
    #[error("Review not found: {0}")]
    ReviewNotFound(String),

    /// Question not found
    #[error("Question not found: {0}")]
    QuestionNotFound(String),

    /// Finding not found
    #[error("Finding not found: {0}")]
    FindingNotFound(String),

    /// Invalid status transition
    #[error("Invalid status: {0}")]
    InvalidStatus(String),

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

    /// JSON serialization/deserialization error
    #[error("JSON error: {0}")]
    Json(#[from] serde_json::Error),

    /// YAML serialization/deserialization error
    #[error("YAML error: {0}")]
    Yaml(#[from] serde_yaml::Error),

    /// Invalid frontmatter
    #[error("Invalid frontmatter: {0}")]
    InvalidFrontmatter(String),

    /// Configuration error
    #[error("Config error: {0}")]
    ConfigError(String),

    /// Invalid path
    #[error("Invalid path: {0}")]
    InvalidPath(String),

    /// Operation failed
    #[error("Operation failed: {0}")]
    OperationFailed(String),
}
