use thiserror::Error;
#[derive(Debug, Error)]
pub enum NeuralError {
#[error("Invalid codebook: {0}")]
InvalidCodebook(String),
#[error("Codebook not found for layer type: {0}")]
CodebookNotFound(String),
#[error("Encoding failed: {0}")]
EncodingError(String),
#[error("Decoding failed: {0}")]
DecodingError(String),
#[error("Invalid NCT file: {0}")]
InvalidFormat(String),
#[error("I/O error: {0}")]
IoError(#[from] std::io::Error),
#[error("Dimension mismatch: expected {expected}, got {actual}")]
DimensionMismatch { expected: usize, actual: usize },
#[error("Training failed: {0}")]
TrainingError(String),
#[error("Quality {actual:.4} below threshold {threshold:.4}")]
QualityThreshold { actual: f32, threshold: f32 },
#[error("Compression ratio {actual:.1}x below target {target:.1}x")]
CompressionRatio { actual: f32, target: f32 },
}
pub type Result<T> = std::result::Result<T, NeuralError>;