use thiserror::Error;
#[derive(Debug, Clone, Error)]
pub enum DatabaseError {
#[error("failed to lock database connection")]
MutexLock,
#[error("database pool error: {0}")]
Pool(String),
#[error("failed to open database connection: {0}")]
ConnectionOpen(String),
#[error("migration failed: {0}")]
Migration(String),
#[error("failed to create database directory: {0}")]
DirectoryCreation(String),
#[error("query failed: {0}")]
Query(String),
#[error("JSON serialization failed: {0}")]
JsonSerialize(String),
#[error("JSON deserialization failed: {0}")]
JsonDeserialize(String),
#[error("integer conversion failed: {0}")]
IntegerConversion(String),
#[error("subject not found: {0}")]
SubjectNotFound(String),
#[error("governance not found: {0}")]
GovernanceNotFound(String),
#[error("event not found for subject {subject_id} at sn {sn}")]
EventNotFound { subject_id: String, sn: u64 },
#[error("no events found for subject: {0}")]
NoEvents(String),
#[error("date/time parse failed: {0}")]
DateTimeParse(String),
#[error("invalid pagination cursor: {0}")]
InvalidCursor(String),
#[error("database blocking task failed: {0}")]
BlockingTask(String),
}