use thiserror::Error;
pub type CorrMatchResult<T> = std::result::Result<T, CorrMatchError>;
#[derive(Error, Debug, Clone, PartialEq, Eq)]
pub enum CorrMatchError {
#[error("invalid dimensions: width={width} height={height}")]
InvalidDimensions { width: usize, height: usize },
#[error("invalid stride: width={width} stride={stride}")]
InvalidStride { width: usize, stride: usize },
#[error("buffer too small: needed={needed} got={got}")]
BufferTooSmall { needed: usize, got: usize },
#[error(
"roi out of bounds: x={x} y={y} width={width} height={height} img_width={img_width} img_height={img_height}"
)]
RoiOutOfBounds {
x: usize,
y: usize,
width: usize,
height: usize,
img_width: usize,
img_height: usize,
},
#[error("degenerate template: {reason}")]
DegenerateTemplate { reason: &'static str },
#[error("invalid angle grid: {reason}")]
InvalidAngleGrid { reason: &'static str },
#[error("index out of bounds: {context} index={index} len={len}")]
IndexOutOfBounds {
index: usize,
len: usize,
context: &'static str,
},
#[error("no candidates: {reason}")]
NoCandidates { reason: &'static str },
#[error("unsupported metric: {metric}")]
UnsupportedMetric { metric: &'static str },
#[error("rotation unavailable: {reason}")]
RotationUnavailable { reason: &'static str },
#[error("image io error: {reason}")]
ImageIo { reason: String },
#[error("parallel execution requested but rayon feature is not enabled")]
ParallelUnavailable,
#[error("invalid config: {reason}")]
InvalidConfig { reason: &'static str },
}