#[derive(Debug, Clone)]
pub enum UniformValue {
    Float(f32),
    Vec3([f32; 3]),
    Vec4([f32; 4]),
    Int(i32),
}

#[derive(Debug, Clone)]
pub struct ShaderUniform {
    pub name: &'static str,
    pub value: UniformValue,
}

pub struct ShaderEndpoint {
    pub name: &'static str,
    pub uniforms: Vec<ShaderUniform>,
}

impl ShaderEndpoint {
    pub fn terrain() -> Self {
        Self {
            name: "europa_terrain_pbr",
            uniforms: vec![
                ShaderUniform {
                    name: "u_planet_radius",
                    value: UniformValue::Float(crate::EUROPA_RADIUS_M as f32),
                },
                ShaderUniform {
                    name: "u_sun_direction",
                    value: UniformValue::Vec3([0.0, 1.0, 0.0]),
                },
                ShaderUniform {
                    name: "u_camera_pos",
                    value: UniformValue::Vec3([0.0, 0.0, 0.0]),
                },
                ShaderUniform {
                    name: "u_surface_temp_k",
                    value: UniformValue::Float(100.0),
                },
                ShaderUniform {
                    name: "u_ice_albedo",
                    value: UniformValue::Float(0.67),
                },
                ShaderUniform {
                    name: "u_crack_color",
                    value: UniformValue::Vec3([0.40, 0.35, 0.30]),
                },
            ],
        }
    }

    pub fn ice_surface() -> Self {
        Self {
            name: "europa_ice_subsurface",
            uniforms: vec![
                ShaderUniform {
                    name: "u_shell_thickness_m",
                    value: UniformValue::Float(20_000.0),
                },
                ShaderUniform {
                    name: "u_surface_temp_k",
                    value: UniformValue::Float(100.0),
                },
                ShaderUniform {
                    name: "u_basal_temp_k",
                    value: UniformValue::Float(273.0),
                },
                ShaderUniform {
                    name: "u_fresnel_power",
                    value: UniformValue::Float(5.0),
                },
                ShaderUniform {
                    name: "u_subsurface_scatter_color",
                    value: UniformValue::Vec3([0.7, 0.85, 1.0]),
                },
            ],
        }
    }

    pub fn eclipse() -> Self {
        Self {
            name: "europa_eclipse",
            uniforms: vec![
                ShaderUniform {
                    name: "u_exposure",
                    value: UniformValue::Float(0.3),
                },
                ShaderUniform {
                    name: "u_gamma",
                    value: UniformValue::Float(2.2),
                },
                ShaderUniform {
                    name: "u_dust_intensity",
                    value: UniformValue::Float(0.01),
                },
            ],
        }
    }
}
