use thiserror::Error;
pub type Result<T> = std::result::Result<T, McvError>;
#[derive(Debug, Error)]
pub enum McvError {
#[cfg(feature = "opencv")]
#[error("OpenCV error: {0}")]
OpenCv(#[from] opencv::Error),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("invalid image: {0}")]
InvalidImage(String),
#[error("invalid ROI: {0}")]
InvalidRoi(String),
#[error("invalid threshold {0}; expected [0, 1]")]
InvalidThreshold(f64),
#[error("invalid color: {0}")]
InvalidColor(String),
#[error("max_count must be positive")]
InvalidMaxCount,
#[cfg(feature = "ocr")]
#[error("OCR error: {0}")]
Ocr(String),
#[cfg(feature = "ocr")]
#[error("missing OCR model file: {0}")]
MissingOcrModel(String),
#[cfg(feature = "ocr")]
#[error("default OCR models are not configured; call set_default_ocr_models first")]
MissingDefaultOcrModels,
#[cfg(feature = "ocr")]
#[error("thread_count must be positive")]
InvalidThreadCount,
#[cfg(feature = "image-crate")]
#[error("image decode error: {0}")]
Image(#[from] image::ImageError),
}