use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum EngineError {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("Journal error: {0}")]
Journal(#[from] journal_core::JournalError),
#[error("Index error: {0}")]
Index(#[from] journal_index::IndexError),
#[error("Repository error: {0}")]
Repository(#[from] journal_registry::repository::RepositoryError),
#[error("Registry error: {0}")]
Registry(#[from] journal_registry::RegistryError),
#[error("Failed to parse journal file path: {path}")]
InvalidPath { path: String },
#[error("Path contains invalid UTF-8: {}", .path.display())]
InvalidUtf8 { path: PathBuf },
#[error("Channel closed")]
ChannelClosed,
#[error("Cache error: {0}")]
Foyer(#[from] foyer::Error),
#[error("Foyer IO error: {0}")]
FoyerIo(#[from] foyer::IoError),
#[error("Operation cancelled")]
Cancelled,
#[error("Invalid time range: start={start} >= end={end}")]
InvalidTimeRange { start: u32, end: u32 },
}
static_assertions::const_assert!(std::mem::size_of::<EngineError>() <= 64);
pub type Result<T> = std::result::Result<T, EngineError>;