use std::sync::Arc;

use glam::*;
use pool::Pool;

mod consts;

/*
** Descriptor Data
*/

// - System
// - Star
// - World
// - Region
//   - Features
// - Terrain
// - Ocean
// - Atmosphere
// - Tectonics?
// - Climate
// - Biomes
// - Ecosystems
// - 

/*
** Runtime Data
*/

// Relief
// Entities (Static, Dynamic)
// Waves
// Weather

struct Layer {

}

struct Region {
    id:usize,
    neighbors:[usize;7],
    layers:Vec<Layer>,
}

struct Cell {
    vertices:glam::IVec3,
}

struct TerrainData {
    vertices:Vec<glam::Vec3>,
    cells:Vec<Cell>,
    extent:[glam::IVec3; 3],
}


struct World {
    regions:Vec<Region>,

    radius:i64,
    density:i64,

    terrain:Option<Arc<Terrain>>,
    ocean:Option<Arc<Ocean>>,
    atmosphere:Option<Arc<Atmosphere>>,
}

struct Terrain {
    relief:i64,
}

struct Ocean {
    depth:i64,
    composition:Vec<(usize, f32)>,
}

struct Atmosphere {
    surface_pressure:i64,
    composition:Vec<(usize, f32)>,
}


enum System {
    Object {
        children:usize,
    },
    Pair,
}

struct StarSystem {
    systems:Vec<System>,
    stars:Vec<Star>,
}

struct Star {
    mass:f32,
    radius:f32,
}

enum Body {
    Star(Star),
    Gas {

    },
    Terrestrial {

    },
}

struct Cosmos {
    worlds:Pool<World>,
    systems:Pool<StarSystem>,
    stars:Vec<Star>,
}
