pub const SECONDS_PER_DAY: f64 = 86_400.0;

#[derive(Debug, Clone, Copy, PartialEq)]
pub struct EuropaDate {
    pub orbit_index: i64,
    pub day_in_orbit: f64,
}

impl EuropaDate {
    pub fn from_elapsed_days(elapsed_days: f64) -> Self {
        let orbit_length = crate::SYNODIC_PERIOD_S / SECONDS_PER_DAY;
        let orbit_index = (elapsed_days / orbit_length).floor() as i64;
        let day_in_orbit = elapsed_days - orbit_index as f64 * orbit_length;
        Self {
            orbit_index,
            day_in_orbit,
        }
    }
}
