use thiserror::Error;

pub type Result<T> = std::result::Result<T, RavencapError>;

#[derive(Debug, Error)]
pub enum RavencapError {
    #[error("invalid options: {0}")]
    InvalidOptions(&'static str),

    #[error("unsupported operation: {0}")]
    Unsupported(&'static str),

    #[error("invalid archive path: {0}")]
    InvalidPath(String),

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

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

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

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

    #[error("serialization error: {0}")]
    Serialization(#[from] serde_json::Error),
}
