use thiserror::Error;
#[derive(Error, Debug)]
pub enum OpenCCError {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("JSON parsing error: {0}")]
Json(#[from] serde_json::Error),
#[error("FST error: {0}")]
Fst(#[from] fst::Error),
#[error("Invalid rkyv dictionary format: {0}")]
InvalidDictFormat(#[from] rkyv::rancor::Error),
#[error("Invalid configuration format: {0}")]
InvalidConfig(String),
#[error("Configuration or resource not found in embedded data: {0}")]
ConfigNotFound(String),
#[error("File not found: {0}")]
FileNotFound(String),
#[error("Unsupported dictionary type: {0}")]
UnsupportedDictType(String),
#[error("Dictionary compile failed")]
DictCompileError(#[from] anyhow::Error),
}
pub type Result<T> = std::result::Result<T, OpenCCError>;