use thiserror::Error;

#[derive(Debug, Error)]
pub enum CrucivError {
    #[error("{0}")]
    Generation(String),

    #[error("Generation timed out - try a smaller grid or lower fill percentage")]
    Timeout(u64),

    #[error("invalid grid: {0}")]
    InvalidGrid(String),

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

    #[error("dictionary error: {0}")]
    Dictionary(String),

    #[error("no clue found for word: {0}")]
    MissingClue(String),

    #[error(transparent)]
    Io(#[from] std::io::Error),

    #[error(transparent)]
    Json(#[from] serde_json::Error),
}

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