//! `mass-decomposition` — a pure-Rust mass-decomposition crate.
//!
//! This crate exposes a small public API for decomposing monoisotopic masses
//! into elemental formulas, with optional isotope-aware ranking. It contains
//! no Polars, no pyo3, and no I/O. All inputs are passed in by the caller.
//!
//! The high-level entry points live in [`scoring`]:
//! - [`decompose_precursor`] for a single precursor mass
//! - [`decompose_fragments`] and [`decompose_fragment_batch`] for a list of
//!   fragment peaks
//!
//! Tolerances are supplied via [`MassTolerance`], which lets callers choose
//! either Daltons or ppm but never both. Dalton tolerances are converted to
//! ppm internally using the 200 Da rule (`max(target_mass, 200 Da)`).
//!
//! Lower-level building blocks are available in [`decomposer`], [`bounds`],
//! [`formula`], [`precomputed`], and [`element`].

pub mod bounds;
pub mod decomposer;
pub mod element;
pub mod error;
pub mod formula;
pub mod precomputed;
pub mod scoring;

// ---------------------------------------------------------------------------
// Re-exports: public API surface.
// ---------------------------------------------------------------------------

pub use crate::bounds::{CalibratedIsotopicModel, IsotopicPatternParams};
pub use crate::decomposer::SpectrumDecomposer;
pub use crate::error::DecompositionError;
pub use crate::formula::formula_to_string;
pub use crate::scoring::{
    Composition, DecompositionConfig, Element, FormulaFeatureConfig, FragmentFormulaResult,
    FragmentPeak, IsotopicPattern, MassTolerance, MolecularFormula, PrecursorInfo,
    composition_from_pairs, decompose_fragment_batch, decompose_fragments, decompose_precursor,
    molecular_formula_from_composition,
};

/// Low-level formula representation exposed for `hrms_utils` compatibility.
///
/// The internal formula representation is a fixed-size array indexed by
/// [`element::ELEMENT_SYMBOLS`]. Index 0 is H, index 1 is C, index 2 is N,
/// index 3 is O, index 4 is F, index 5 is Na, index 6 is P, index 7 is S,
/// index 8 is Cl, index 9 is K, index 10 is Br, index 11 is I.
pub type Formula = [i32; crate::element::NUM_ELEMENTS];
