//! Planet configuration resource.

use bevy_ecs::resource::Resource;
use bevy_reflect::Reflect;

/// Configuration resource defining the planet's properties.
///
/// This is a global, single-planet configuration (radius). Per-floating-origin
/// recenter behaviour lives on [`FloatingOrigin`](crate::origin::FloatingOrigin)
/// itself so split-screen / networked-player scenarios can carry independent
/// thresholds.
///
/// Multi-planet support (multiple roots with different radii) is not yet
/// implemented — see the README roadmap.
///
/// # Example
///
/// ```rust,ignore
/// app.insert_resource(PlanetSettings::earth());
/// ```
#[derive(Resource, Debug, Clone, Reflect)]
pub struct PlanetSettings {
    /// Planet radius in world units (e.g., metres).
    pub radius: f64,
}

impl Default for PlanetSettings {
    fn default() -> Self {
        Self {
            radius: 6_371_000.0, // Earth radius in metres.
        }
    }
}

impl PlanetSettings {
    /// Create settings for an Earth-sized planet.
    pub fn earth() -> Self {
        Self::default()
    }

    /// Set the planet radius (in world units).
    pub fn with_radius(mut self, radius: f64) -> Self {
        self.radius = radius;
        self
    }
}
