use thiserror::Error;
#[derive(Error, Debug)]
pub enum StorageError {
#[error("Could not find data directory")]
NoDataDir,
#[error("Could not locate config directory")]
NoConfigDir,
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("Text attachment is not valid UTF-8: {0}")]
InvalidUtf8(#[from] std::str::Utf8Error),
#[error("Empty image data")]
EmptyImage,
#[error("Invalid hash format")]
InvalidHash,
#[error("Invalid document conversion: {0}")]
InvalidDocumentConversion(String),
#[error("Image not found: {0}")]
ImageNotFound(String),
#[error("Thread not found: {0}")]
ThreadNotFound(String),
#[error("Workspace not found: {0}")]
WorkspaceNotFound(String),
#[error("Invalid workspace name")]
InvalidWorkspaceName,
#[error("Invalid workspace path: {0}")]
InvalidWorkspacePath(String),
#[error("Invalid thread message: {0}")]
InvalidThreadMessage(String),
#[error("Profile not found: {0}")]
ProfileNotFound(String),
#[error("Cannot delete the last profile")]
CannotDeleteLastProfile,
#[error("Invalid profile ID: {0}")]
InvalidProfileId(String),
#[error("{0}")]
AuthState(String),
#[error("{0}")]
KeyStore(String),
#[error("Unsupported OCR model id: {0}")]
InvalidOcrModel(String),
}
pub type Result<T> = std::result::Result<T, StorageError>;