use serde::Deserialize;

template_id!(MainCityObject tag_id);

#[derive(Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct MainCityObjectTemplate {
    #[serde(rename = "TagID")]
    pub tag_id: MainCityObjectID,
    #[serde(rename = "NPCID")]
    pub npc_id: u32,
    pub create_position: String,
    pub create_type: u32,
    #[serde(rename = "DefaultInteractIDs")]
    pub default_interact_ids: Vec<u32>,
    pub interact_name: String,
    pub interact_shape: u32,
    pub interact_scale: String,
    pub focus_interact_scale: f32,
    pub camera_story_key: String,
}

impl MainCityObjectTemplate {
    pub fn get_section_name(&self) -> String {
        let section_name = self.create_position.split('_').next().unwrap();
        format!("SectionName_{section_name}")
    }
}
