use data::tables::ProcedureConfigID;
use proto::{DungeonInfo, FreshSceneInfo, SceneInfo};

use crate::logic::{procedure::ProcedureManager, ESceneType};

use super::NapGameMode;

pub struct FreshGame {
    pub procedure_mgr: ProcedureManager,
}

impl FreshGame {
    pub fn new(start_procedure_id: ProcedureConfigID) -> Self {
        Self {
            procedure_mgr: ProcedureManager::new(start_procedure_id),
        }
    }
}

impl NapGameMode for FreshGame {
    fn scene_type(&self) -> ESceneType {
        ESceneType::Fresh
    }

    fn scene_info(&self) -> Option<SceneInfo> {
        Some(SceneInfo {
            scene_type: self.scene_type() as u32,
            fresh_scene_info: Some(FreshSceneInfo {
                beginner_procedure_id: self
                    .procedure_mgr
                    .procedure_id()
                    .map(|i| i.value() - 1)
                    .unwrap_or(0),
            }),
            ..Default::default()
        })
    }

    fn dungeon_info(&self) -> Option<DungeonInfo> {
        None
    }
}
