use std::sync::LazyLock;

use common::util::load_or_create_config;
use serde::Deserialize;


const DEFAULT_CONFIG: &str = include_str!("../gameserver.default.json");

#[derive(Deserialize)]
pub struct GameServerConfig {
    pub gateway_endpoint: String,
    pub skip_tutorial: bool,
    pub manual_chain_attacks: bool,
    pub characters_lvl: u8,
    pub characters_ascension_rank: u8,
    pub characters_star_rank: u8,
    pub characters_unlocked_talents: u8,
    pub characters_normal_atk_lvl : u8,
    pub characters_special_lvl : u8,
    pub characters_dodge_lvl : u8,
    pub characters_ult_lvl : u8,
    pub system_resources_logging: bool,
}

pub static CONFIGURATION: LazyLock<GameServerConfig> = LazyLock::new(|| {
    serde_json::from_str(&load_or_create_config("gameserver.json", DEFAULT_CONFIG))
        .expect("Failed to parse server configuration file")
});

pub fn init_config() {
    let _configuration = &*CONFIGURATION;
}
