use thiserror::Error;

#[derive(Debug, Error)]
pub enum GitError {
    #[error("Git operation error: {0}")]
    OperationError(#[from] anyhow::Error),
}

#[derive(Debug, Error)]
pub enum ComponentError {
    #[error("Git operation failed: {0}")]
    GitError(#[from] GitError),
}

#[derive(Debug, Error)]
pub enum CommandError {
    #[error("Git command failed: {0}")]
    GitError(#[from] GitError),
}

#[derive(Debug, Error)]
pub enum ServiceError {
    #[error("Git service error: {0}")]
    GitError(#[from] GitError),
    
    #[error("File watcher error: {0}")]
    FileWatcherError(#[from] notify::Error),
}

#[derive(Debug, Error)]
pub enum ApplicationError {
    #[error("Component error: {0}")]
    ComponentError(#[from] ComponentError),
    
    #[error("Command error: {0}")]
    CommandError(#[from] CommandError),
    
    #[error("Service error: {0}")]
    ServiceError(#[from] ServiceError),
    
    #[error("Event stream closed")]
    EventStreamClosed,
    
    #[error("Component initialization failed: {0}")]
    ComponentInitFailed(ComponentError),
    
    #[error("IO error: {0}")]
    IoError(#[from] std::io::Error),
}
