use std::collections::HashMap;
use serde::Deserialize;
use serde_yaml::Value;

#[derive(Debug, Deserialize)]
pub struct EntityManifest {
    pub components: HashMap<String, Value>,
}

#[derive(Debug, Deserialize)]
pub struct ProjectManifest {
    pub name: String,
    #[serde(rename = "type")]
    pub project_type: String,
    pub version: String,
    pub description: Option<String>,
    pub author: Option<String>,
    pub engine: Option<String>,
    pub config: Option<ProjectConfig>,
}

#[derive(Debug, Deserialize)]
pub struct ProjectConfig {
    pub entry_scene: String,
    pub asset_root: Option<String>,
    pub window: Option<WindowConfig>,
}

#[derive(Debug, Deserialize)]
pub struct WindowConfig {
    pub title: Option<String>,
    pub width: Option<u32>,
    pub height: Option<u32>,
    pub resizable: Option<bool>,
}

#[derive(Debug, Deserialize)]
pub struct SceneManifest {
    pub entities: HashMap<String, EntityInstance>,
}

#[derive(Debug, Deserialize)]
pub struct EntityInstance {
    pub template: Option<String>,
    #[serde(flatten)]
    pub components: HashMap<String, Value>,
}

#[derive(Debug, Deserialize)]
pub struct ScenarioManifest {
    pub scenario: Scenario,
}

#[derive(Debug, Deserialize)]
pub struct Scenario {
    pub entry_scene: String,
    pub defaults: Option<ScenarioDefaults>,
    pub scenes: Vec<ScenarioScene>,
}

#[derive(Debug, Deserialize)]
pub struct ScenarioDefaults {
    pub requirements: Option<ScenarioRequirements>,
}

#[derive(Debug, Deserialize)]
pub struct ScenarioRequirements {
    pub network: Option<String>,
    pub access: Option<String>,
}

#[derive(Debug, Deserialize)]
pub struct ScenarioScene {
    pub name: String,
    pub requirements: Option<ScenarioRequirements>,
}