use super::tsv_util::{default_if_empty, from_sequence};
use serde::Deserialize;

#[derive(Deserialize, Default, Debug, Clone, Copy, PartialEq, Eq)]
pub enum SceneType {
    #[default]
    Unknown,
    #[serde(rename = "SCENE_WORLD")]
    World,
    #[serde(rename = "SCENE_DUNGEON")]
    Dungeon,
    #[serde(rename = "SCENE_ROOM")]
    Room,
    #[serde(rename = "SCENE_HOME_WORLD")]
    HomeWorld,
    #[serde(rename = "SCENE_HOME_ROOM")]
    HomeRoom,
}

#[derive(Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[serde(default)]
pub struct SceneData {
    #[serde(deserialize_with = "default_if_empty")]
    pub id: u32,
    pub r#type: SceneType,
    pub subtype: String,
    pub ignore_nav_mesh: String,
    pub script_data: String,
    pub override_default_profile: String,
    pub level_entity_config: String,
    #[serde(deserialize_with = "default_if_empty")]
    pub entity_appear_sorted: u32,
    #[serde(deserialize_with = "from_sequence")]
    pub specified_avatar_list: Vec<u32>,
    #[serde(deserialize_with = "default_if_empty")]
    pub max_specified_avatar_num: u32,
    #[serde(deserialize_with = "from_sequence")]
    pub boundary_point_vec: Vec<f32>,
    #[serde(deserialize_with = "from_sequence")]
    pub dungeon_entry_point: Vec<u32>,
    pub navmesh_mode: String,
    #[serde(deserialize_with = "default_if_empty")]
    pub is_allow_map_mark_point: bool,
    #[serde(deserialize_with = "default_if_empty")]
    pub safe_point: u32,
    #[serde(deserialize_with = "default_if_empty")]
    pub use_to_the_moon: bool,
}
