use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RuntimeWorldFinanceNeighborhoodCandidate {
    pub label: String,
    pub relative_offset: usize,
    pub relative_offset_hex: String,
    pub raw_u32: u32,
    pub raw_u32_hex: String,
    pub value_i32: i32,
    pub value_f32_text: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RuntimeCompanyStatBandCandidate {
    pub label: String,
    pub relative_offset: usize,
    pub relative_offset_hex: String,
    pub raw_u32: u32,
    pub raw_u32_hex: String,
    pub value_i32: i32,
    pub value_f32_text: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct RuntimeWorldRestoreState {
    #[serde(default)]
    pub selected_year_profile_lane: Option<u8>,
    #[serde(default)]
    pub campaign_scenario_enabled: Option<bool>,
    #[serde(default)]
    pub sandbox_enabled: Option<bool>,
    #[serde(default)]
    pub seed_tuple_written_from_raw_lane: Option<bool>,
    #[serde(default)]
    pub absolute_counter_requires_shell_context: Option<bool>,
    #[serde(default)]
    pub absolute_counter_reconstructible_from_save: Option<bool>,
    #[serde(default)]
    pub current_calendar_tuple_word_raw_u32: Option<u32>,
    #[serde(default)]
    pub packed_year_word_raw_u16: Option<u16>,
    #[serde(default)]
    pub partial_year_progress_raw_u8: Option<u8>,
    #[serde(default)]
    pub current_calendar_tuple_word_2_raw_u32: Option<u32>,
    #[serde(default)]
    pub absolute_counter_raw_u32: Option<u32>,
    #[serde(default)]
    pub absolute_counter_mirror_raw_u32: Option<u32>,
    #[serde(default)]
    pub disable_cargo_economy_special_condition_slot: Option<u8>,
    #[serde(default)]
    pub disable_cargo_economy_special_condition_reconstructible_from_save: Option<bool>,
    #[serde(default)]
    pub disable_cargo_economy_special_condition_write_side_grounded: Option<bool>,
    #[serde(default)]
    pub disable_cargo_economy_special_condition_enabled: Option<bool>,
    #[serde(default)]
    pub use_bio_accelerator_cars_enabled: Option<bool>,
    #[serde(default)]
    pub use_wartime_cargos_enabled: Option<bool>,
    #[serde(default)]
    pub disable_train_crashes_enabled: Option<bool>,
    #[serde(default)]
    pub disable_train_crashes_and_breakdowns_enabled: Option<bool>,
    #[serde(default)]
    pub ai_ignore_territories_at_startup_enabled: Option<bool>,
    #[serde(default)]
    pub limited_track_building_amount: Option<i32>,
    #[serde(default)]
    pub economic_status_code: Option<i32>,
    #[serde(default)]
    pub territory_access_cost: Option<u32>,
    #[serde(default)]
    pub linked_site_removal_follow_on_gate_raw_u8: Option<u8>,
    #[serde(default)]
    pub linked_site_removal_follow_on_gate_enabled: Option<bool>,
    #[serde(default)]
    pub auto_show_grade_during_track_lay_raw_u8: Option<u8>,
    #[serde(default)]
    pub starting_building_density_level_raw_u8: Option<u8>,
    #[serde(default)]
    pub post_text_building_density_growth_raw_u8: Option<u8>,
    #[serde(default)]
    pub leftover_simulation_time_accumulator_raw_u32: Option<u32>,
    #[serde(default)]
    pub leftover_simulation_time_accumulator_value_f32_text: Option<String>,
    #[serde(default)]
    pub selected_year_lane_snapshot_raw_u8: Option<u8>,
    #[serde(default)]
    pub all_steam_locomotives_available_raw_u8: Option<u8>,
    #[serde(default)]
    pub all_steam_locomotives_available_enabled: Option<bool>,
    #[serde(default)]
    pub all_diesel_locomotives_available_raw_u8: Option<u8>,
    #[serde(default)]
    pub all_diesel_locomotives_available_enabled: Option<bool>,
    #[serde(default)]
    pub all_electric_locomotives_available_raw_u8: Option<u8>,
    #[serde(default)]
    pub all_electric_locomotives_available_enabled: Option<bool>,
    #[serde(default)]
    pub issue_37_value: Option<u32>,
    #[serde(default)]
    pub issue_38_value: Option<u32>,
    #[serde(default)]
    pub issue_39_value: Option<u32>,
    #[serde(default)]
    pub issue_3a_value: Option<u32>,
    #[serde(default)]
    pub issue_37_multiplier_raw_u32: Option<u32>,
    #[serde(default)]
    pub issue_37_multiplier_value_f32_text: Option<String>,
    #[serde(default)]
    pub stock_issue_and_buyback_policy_raw_u8: Option<u8>,
    #[serde(default)]
    pub bond_issue_and_repayment_policy_raw_u8: Option<u8>,
    #[serde(default)]
    pub bankruptcy_policy_raw_u8: Option<u8>,
    #[serde(default)]
    pub dividend_policy_raw_u8: Option<u8>,
    #[serde(default)]
    pub building_density_growth_setting_raw_u32: Option<u32>,
    #[serde(default)]
    pub stock_issue_and_buyback_allowed: Option<bool>,
    #[serde(default)]
    pub bond_issue_and_repayment_allowed: Option<bool>,
    #[serde(default)]
    pub bankruptcy_allowed: Option<bool>,
    #[serde(default)]
    pub dividend_adjustment_allowed: Option<bool>,
    #[serde(default)]
    pub finance_neighborhood_candidates: Vec<RuntimeWorldFinanceNeighborhoodCandidate>,
    #[serde(default)]
    pub economic_tuning_mirror_raw_u32: Option<u32>,
    #[serde(default)]
    pub economic_tuning_mirror_value_f32_text: Option<String>,
    #[serde(default)]
    pub economic_tuning_lane_raw_u32: Vec<u32>,
    #[serde(default)]
    pub economic_tuning_lane_value_f32_text: Vec<String>,
    #[serde(default)]
    pub cached_available_locomotive_rating_raw_u32: Option<u32>,
    #[serde(default)]
    pub cached_available_locomotive_rating_value_f32_text: Option<String>,
    #[serde(default)]
    pub selected_year_bucket_scalar_raw_u32: Option<u32>,
    #[serde(default)]
    pub selected_year_bucket_scalar_value_f32_text: Option<String>,
    #[serde(default)]
    pub selected_year_bucket_direct_lane_raw_u32: Vec<u32>,
    #[serde(default)]
    pub selected_year_bucket_direct_lane_value_f32_text: Vec<String>,
    #[serde(default)]
    pub selected_year_bucket_complement_lane_raw_u32: Vec<u32>,
    #[serde(default)]
    pub selected_year_bucket_complement_lane_value_f32_text: Vec<String>,
    #[serde(default)]
    pub selected_year_bucket_scaled_companion_lane_raw_u32: Vec<u32>,
    #[serde(default)]
    pub selected_year_bucket_scaled_companion_lane_value_f32_text: Vec<String>,
    #[serde(default)]
    pub selected_year_gap_scalar_raw_u32: Option<u32>,
    #[serde(default)]
    pub selected_year_gap_scalar_value_f32_text: Option<String>,
    #[serde(default)]
    pub absolute_counter_restore_kind: Option<String>,
    #[serde(default)]
    pub absolute_counter_adjustment_context: Option<String>,
}
