use thiserror::Error;

#[derive(Error, Debug)]
#[allow(dead_code)]
pub enum PipConfError {
    #[error("Config file not found: {0}")]
    ConfigNotFound(String),

    #[error("Config file parse error in '{file}' at line {line}: {msg}")]
    ParseError {
        file: String,
        line: usize,
        msg: String,
    },

    #[error("Section '{0}' not found")]
    SectionNotFound(String),

    #[error("Key '{key}' not found in section '[{section}]'")]
    KeyNotFound { section: String, key: String },

    #[error("Invalid value '{value}' for key '{key}': {reason}")]
    InvalidValue {
        key: String,
        value: String,
        reason: String,
    },

    #[error("Permission denied writing to '{0}'. Try running with elevated privileges.")]
    PermissionDenied(String),

    #[error("Backup failed: {0}")]
    BackupFailed(String),

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

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

    #[error("Unknown key '{0}'. Use 'pipconf schema' to list valid keys.")]
    UnknownKey(String),

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

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