pub struct CmeImpact {
    pub speed_km_s: f64,
    pub density_multiplier: f64,
    pub magnetic_field_nt: f64,
    pub duration_hours: f64,
}

impl CmeImpact {
    pub fn typical() -> Self {
        Self {
            speed_km_s: 800.0,
            density_multiplier: 4.0,
            magnetic_field_nt: 80.0,
            duration_hours: 12.0,
        }
    }

    pub fn extreme() -> Self {
        Self {
            speed_km_s: 2000.0,
            density_multiplier: 10.0,
            magnetic_field_nt: 200.0,
            duration_hours: 6.0,
        }
    }

    pub fn dynamic_pressure(&self) -> f64 {
        let n = super::winds::SOLAR_WIND_DENSITY_CM3 * self.density_multiplier * 1e6;
        let v = self.speed_km_s * 1000.0;
        let m_proton = 1.6726e-27;
        0.5 * n * m_proton * v * v
    }

    pub fn magnetopause_collapse(&self) -> bool {
        let p_sw = self.dynamic_pressure();
        let p_mag = crate::EQUATORIAL_FIELD_T.powi(2) / (2.0 * 1.2566e-6);
        p_sw > p_mag * 5.0
    }

    pub fn exosphere_enhancement(&self) -> f64 {
        self.density_multiplier * (self.speed_km_s / 400.0)
    }
}

pub fn sep_flux_enhancement() -> f64 {
    let r_au = 0.387;
    1.0 / (r_au * r_au)
}

pub fn mean_cme_interval_days() -> f64 {
    14.0
}

pub fn reconnection_rate_relative_to_earth() -> f64 {
    10.0
}
