use thiserror::Error;
#[derive(Error, Debug)]
pub enum RkvsError {
#[error("Storage error: {0}")]
Storage(String),
#[error("Snapshot file not found: {0}")]
SnapshotNotFound(String),
#[error("Serialization error")]
Serialization(#[from] bincode::Error),
#[error("I/O error")]
Io(#[from] std::io::Error),
#[error("Internal error: {0}")]
Internal(String),
#[error("Storage not initialized. Call initialize() first.")]
NotInitialized,
#[error("Persistence is not enabled")]
PersistenceNotEnabled,
#[error("Namespace '{0}' already exists")]
NamespaceAlreadyExists(String),
#[error("Namespace '{0}' not found")]
NamespaceNotFound(String),
#[error("Maximum number of namespaces ({0}) reached")]
MaxNamespacesReached(usize),
#[error("Autosave task for namespace '{0}' is already running")]
AutosaveTaskAlreadyExists(String),
#[error("No autosave configuration found for namespace '{0}'")]
AutosaveConfigNotFound(String),
#[error("No active autosave task found for namespace '{0}'")]
AutosaveTaskNotFound(String),
}
pub type Result<T> = std::result::Result<T, RkvsError>;