//! Error types for the Projects module.

use thiserror::Error;
use uuid::Uuid;

/// Errors that can occur in project operations.
#[derive(Debug, Error)]
pub enum ProjectError {
    /// Project not found
    #[error("project not found: {0}")]
    NotFound(Uuid),

    /// Project already exists
    #[error("project already exists: {0}")]
    AlreadyExists(Uuid),

    /// Repository not found
    #[error("repository not found: {0}")]
    RepositoryNotFound(Uuid),

    /// Worktree not found
    #[error("worktree not found: {0}")]
    WorktreeNotFound(Uuid),

    /// Binding not found
    #[error("binding not found: {0}")]
    BindingNotFound(Uuid),

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

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

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

/// Result type alias for project operations.
pub type Result<T> = std::result::Result<T, ProjectError>;
