use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum AttunedError {
#[error("validation error: {0}")]
Validation(#[from] ValidationError),
#[error("storage error: {0}")]
Storage(String),
#[error("serialization error: {0}")]
Serialization(#[from] serde_json::Error),
}
#[derive(Debug, Error, PartialEq)]
#[non_exhaustive]
pub enum ValidationError {
#[error("axis '{axis}' has value {value} outside valid range [0.0, 1.0]")]
AxisOutOfRange {
axis: String,
value: f32,
},
#[error("axis name '{axis}' contains invalid characters (must be lowercase alphanumeric with underscores)")]
InvalidAxisName {
axis: String,
},
#[error("user_id cannot be empty")]
EmptyUserId,
#[error("user_id exceeds maximum length of {max} characters")]
UserIdTooLong {
max: usize,
},
#[error("user_id contains invalid characters (must be alphanumeric, underscore, or hyphen)")]
InvalidUserIdChars,
#[error("confidence {value} is outside valid range [0.0, 1.0]")]
ConfidenceOutOfRange {
value: f32,
},
#[error("missing required field: {field}")]
MissingField {
field: String,
},
}