use serde::{Deserialize, Serialize};

#[derive(Default, Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub enum LightType {
    #[default]
    Directional,
    Point,
    Spot,
}

#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct Light {
    pub light_type: LightType,
    pub color: nalgebra_glm::Vec3,
    pub intensity: f32,
    pub range: f32,
    pub inner_cone_angle: f32,
    pub outer_cone_angle: f32,
    pub cast_shadows: bool,
    pub shadow_bias: f32,
}

impl Light {
    pub fn with_shadows(mut self, bias: f32) -> Self {
        self.cast_shadows = true;
        self.shadow_bias = bias;
        self
    }
}
