use claw_guard::error::GuardError;
pub type ClawDBResult<T> = Result<T, ClawDBError>;
#[derive(Debug, thiserror::Error)]
pub enum ClawDBError {
#[error("storage error: {0}")]
Core(#[from] claw_core::ClawError),
#[error("vector error: {0}")]
Vector(#[from] claw_vector::VectorError),
#[error("branch error: {0}")]
Branch(#[from] claw_branch::BranchError),
#[error("sync error: {0}")]
Sync(#[from] claw_sync::SyncError),
#[error("guard error: {0}")]
Guard(#[from] GuardError),
#[error("reflect error: {0}")]
Reflect(#[from] claw_reflect_client::ReflectError),
#[error("permission denied: {0}")]
PermissionDenied(String),
#[error("component disabled: {0}")]
ComponentDisabled(&'static str),
#[error("component init failed ({0}): {1}")]
ComponentInit(&'static str, String),
#[error("configuration error: {0}")]
Config(String),
#[error("session expired or invalid")]
SessionInvalid,
#[error("transaction error: {0}")]
Transaction(String),
#[error("serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
}