use thiserror::Error;
#[derive(Error, Debug)]
pub enum SdfError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Parse error at line {line}: {message}")]
Parse { line: usize, message: String },
#[error("Invalid atom count: expected {expected}, found {found}")]
AtomCountMismatch { expected: usize, found: usize },
#[error("Invalid bond count: expected {expected}, found {found}")]
BondCountMismatch { expected: usize, found: usize },
#[error("Invalid atom index {index} in bond (molecule has {atom_count} atoms)")]
InvalidAtomIndex { index: usize, atom_count: usize },
#[error("Invalid bond order: {0}")]
InvalidBondOrder(u8),
#[error("Invalid counts line format: {0}")]
InvalidCountsLine(String),
#[error("Missing required section: {0}")]
MissingSection(String),
#[error("Empty file")]
EmptyFile,
#[error("Invalid coordinate value: {0}")]
InvalidCoordinate(String),
#[error("Invalid charge value: {0}")]
InvalidCharge(String),
#[error("Invalid V3000 block: {0}")]
InvalidV3000Block(String),
#[error("Invalid V3000 atom line at line {line}: {message}")]
InvalidV3000AtomLine { line: usize, message: String },
#[error("Invalid V3000 bond line at line {line}: {message}")]
InvalidV3000BondLine { line: usize, message: String },
#[error("Atom ID {id} not found in V3000 ID mapping")]
AtomIdNotFound { id: u32 },
#[error("Unsupported V3000 feature: {0}")]
UnsupportedV3000Feature(String),
#[error("Gzip file detected but gzip feature not enabled. Enable with: --features gzip")]
GzipNotEnabled,
#[error("Bond inference: unknown element '{element}' at atom index {index}")]
BondInferenceError { element: String, index: usize },
}
pub type Result<T> = std::result::Result<T, SdfError>;