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

impl JupiterView {
    pub fn sub_jupiter_default() -> Self {
        Self {
            jupiter_elevation_deg: 89.0,
            apparent_diameter_deg: 12.0,
            illuminated_fraction: 0.60,
        }
    }

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

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