#[derive(Debug, Clone, Copy, PartialEq)]
pub struct MarsView {
    pub mars_elevation_deg: f64,
    pub apparent_diameter_deg: f64,
    pub illuminated_fraction: f64,
}

impl MarsView {
    pub fn sub_mars_default() -> Self {
        Self {
            mars_elevation_deg: 89.0,
            apparent_diameter_deg: 16.5,
            illuminated_fraction: 0.80,
        }
    }

    pub fn is_visible(&self) -> bool {
        self.mars_elevation_deg > 0.0
    }
}

pub fn marsshine_gain(view: MarsView, surface_albedo: f64) -> f64 {
    if view.is_visible() {
        view.illuminated_fraction * view.apparent_diameter_deg * surface_albedo.max(0.0)
    } else {
        0.0
    }
}
