use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Error, Debug, Clone, PartialEq)]
pub enum Error {
#[error("Invalid field type: {field_type}")]
InvalidFieldType { field_type: String },
#[error("Invalid header format: {reason}")]
InvalidHeader { reason: String },
#[error("Invalid sequence number: {line}")]
InvalidSequenceNumber { line: String },
#[error("Schema mismatch: expected {expected} fields, got {actual}")]
SchemaMismatch { expected: usize, actual: usize },
#[error("Invalid value for field '{field}' of type {field_type}: {value}")]
InvalidValue {
field: String,
field_type: String,
value: String,
},
#[error("Missing header line")]
MissingHeader,
#[error("Document is empty")]
EmptyDocument,
#[error("Field '{field}' not found in schema")]
FieldNotFound { field: String },
#[error("Duplicate field name: {field}")]
DuplicateField { field: String },
#[error("Row {row_index} validation failed: {reason}")]
RowValidation { row_index: usize, reason: String },
#[error("Invalid hex value: {value}")]
InvalidHex { value: String },
#[error("Invalid number: {value}")]
InvalidNumber { value: String },
#[error("IO error: {0}")]
Io(String),
}