use std::collections::BTreeMap;

use serde::{Deserialize, Serialize};

use super::companies::RuntimeCompanyControllerKind;

fn runtime_player_default_active() -> bool {
    true
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RuntimePlayer {
    pub player_id: u32,
    pub current_cash: i64,
    #[serde(default = "runtime_player_default_active")]
    pub active: bool,
    #[serde(default)]
    pub controller_kind: RuntimeCompanyControllerKind,
}

fn runtime_chairman_profile_default_active() -> bool {
    true
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RuntimeChairmanProfile {
    pub profile_id: u32,
    pub name: String,
    #[serde(default = "runtime_chairman_profile_default_active")]
    pub active: bool,
    #[serde(default)]
    pub current_cash: i64,
    #[serde(default)]
    pub linked_company_id: Option<u32>,
    #[serde(default)]
    pub company_holdings: BTreeMap<u32, u32>,
    #[serde(default)]
    pub holdings_value_total: i64,
    #[serde(default)]
    pub net_worth_total: i64,
    #[serde(default)]
    pub purchasing_power_total: i64,
}
