//! Error types for query operations.

use stemedb_storage::StorageError;
use thiserror::Error;

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

/// Errors that can occur during query execution.
#[derive(Error, Debug)]
pub enum QueryError {
    /// Error from the storage layer.
    #[error("Storage error: {0}")]
    Storage(#[from] StorageError),

    /// Error deserializing stored data.
    #[error("Deserialization error: {0}")]
    Deserialization(String),

    /// Query validation error.
    #[error("Invalid query: {0}")]
    InvalidQuery(String),

    /// Invalid input (e.g., malformed hex string).
    #[error("Invalid input: {0}")]
    InvalidInput(String),

    /// Error from an index operation.
    #[error("Index error: {0}")]
    Index(String),
}
