use thiserror::Error;

/// Result type for storage operations.
pub type Result<T> = std::result::Result<T, StorageError>;

/// Errors that can occur during storage operations.
#[derive(Error, Debug)]
pub enum StorageError {
    /// IO error interacting with the storage backend.
    #[error("Storage IO error: {0}")]
    Io(#[from] std::io::Error),

    /// Error from the underlying storage backend (fjall, redb, etc.).
    #[error("Backend error: {0}")]
    Backend(String),

    /// Serialization/Deserialization error.
    #[error("Serialization error: {0}")]
    Serialization(String),

    /// Key not found in storage.
    #[error("Key not found: {0}")]
    NotFound(String),

    /// Input validation error (e.g., dimension mismatch, invalid values).
    #[error("Input validation error: {0}")]
    InputValidation(String),
}
