use thiserror::Error;
use crate::mnn::MnnError;
#[derive(Error, Debug)]
pub enum OcrError {
#[error("MNN inference error: {0}")]
MnnError(#[from] MnnError),
#[error("Image processing error: {0}")]
ImageError(#[from] image::ImageError),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
#[error("Invalid parameter: {0}")]
InvalidParameter(String),
#[error("Model loading failed: {0}")]
ModelLoadError(String),
#[error("Preprocessing error: {0}")]
PreprocessError(String),
#[error("Postprocessing error: {0}")]
PostprocessError(String),
#[error("Detection error: {0}")]
DetectionError(String),
#[error("Recognition error: {0}")]
RecognitionError(String),
#[error("Not initialized: {0}")]
NotInitialized(String),
#[error("Charset parsing error: {0}")]
CharsetError(String),
}
pub type OcrResult<T> = std::result::Result<T, OcrError>;