#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ExosphereSpecies {
    pub name: &'static str,
    pub abundance_fraction: f64,
    pub scale_height_km: f64,
}

pub fn reference_composition() -> Vec<ExosphereSpecies> {
    vec![
        ExosphereSpecies {
            name: "H2O",
            abundance_fraction: 0.30,
            scale_height_km: 2.0,
        },
        ExosphereSpecies {
            name: "CO2",
            abundance_fraction: 0.25,
            scale_height_km: 1.5,
        },
        ExosphereSpecies {
            name: "O2",
            abundance_fraction: 0.18,
            scale_height_km: 3.0,
        },
        ExosphereSpecies {
            name: "Ar",
            abundance_fraction: 0.12,
            scale_height_km: 1.8,
        },
        ExosphereSpecies {
            name: "N2",
            abundance_fraction: 0.10,
            scale_height_km: 2.5,
        },
        ExosphereSpecies {
            name: "Ne",
            abundance_fraction: 0.05,
            scale_height_km: 4.0,
        },
    ]
}

pub fn dominant_species(species: &[ExosphereSpecies]) -> Option<ExosphereSpecies> {
    species
        .iter()
        .copied()
        .max_by(|a, b| a.abundance_fraction.total_cmp(&b.abundance_fraction))
}
