use serde::{Deserialize, Serialize};

use crate::inspect::smp::common::SmpSaveDwordCandidate;

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SmpSaveWorldEconomicTuningProbe {
    pub profile_family: String,
    pub source_kind: String,
    pub semantic_family: String,
    pub chunk_tag_offset: usize,
    pub payload_offset: usize,
    pub payload_len: usize,
    pub payload_len_hex: String,
    pub mirror_lane: SmpSaveDwordCandidate,
    pub tuning_lanes: Vec<SmpSaveDwordCandidate>,
    pub evidence: Vec<String>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SmpSaveWorldIssue37Probe {
    pub profile_family: String,
    pub source_kind: String,
    pub semantic_family: String,
    pub chunk_tag_offset: usize,
    pub payload_offset: usize,
    pub payload_len: usize,
    pub payload_len_hex: String,
    pub issue_37_raw_u8: u8,
    pub issue_37_raw_hex: String,
    pub issue_38_raw_u8: u8,
    pub issue_38_raw_hex: String,
    pub issue_39_raw_u8: u8,
    pub issue_39_raw_hex: String,
    pub issue_3a_raw_u8: u8,
    pub issue_3a_raw_hex: String,
    pub issue_value_lane: SmpSaveDwordCandidate,
    pub multiplier_lane: SmpSaveDwordCandidate,
    #[serde(default)]
    pub issue_opinion_base_terms_raw_i32: Vec<i32>,
    pub evidence: Vec<String>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SmpSaveWorldFinanceNeighborhoodProbe {
    pub profile_family: String,
    pub source_kind: String,
    pub semantic_family: String,
    pub chunk_tag_offset: usize,
    pub payload_offset: usize,
    pub payload_len: usize,
    pub payload_len_hex: String,
    pub packed_year_word_raw_u16: u16,
    pub packed_year_word_raw_hex: String,
    pub partial_year_progress_raw_u8: u8,
    pub partial_year_progress_raw_hex: String,
    pub current_calendar_tuple_word_lane: SmpSaveDwordCandidate,
    pub current_calendar_tuple_word_2_lane: SmpSaveDwordCandidate,
    pub absolute_counter_lane: SmpSaveDwordCandidate,
    pub absolute_counter_mirror_lane: SmpSaveDwordCandidate,
    pub stock_policy_raw_u8: u8,
    pub stock_policy_raw_hex: String,
    pub bond_policy_raw_u8: u8,
    pub bond_policy_raw_hex: String,
    pub bankruptcy_policy_raw_u8: u8,
    pub bankruptcy_policy_raw_hex: String,
    pub dividend_policy_raw_u8: u8,
    pub dividend_policy_raw_hex: String,
    pub building_density_growth_setting_lane: SmpSaveDwordCandidate,
    pub dword_candidates: Vec<SmpSaveDwordCandidate>,
    pub evidence: Vec<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SmpLoadedWorldIssue37State {
    pub source_kind: String,
    pub semantic_family: String,
    pub issue_value: u32,
    pub issue_value_hex: String,
    pub issue_38_value: u32,
    pub issue_38_value_hex: String,
    pub issue_39_value: u32,
    pub issue_39_value_hex: String,
    pub issue_3a_value: u32,
    pub issue_3a_value_hex: String,
    pub multiplier_raw_u32: u32,
    pub multiplier_raw_hex: String,
    pub multiplier_value_f32_text: String,
    #[serde(default)]
    pub issue_opinion_base_terms_raw_i32: Vec<i32>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SmpLoadedWorldEconomicTuningState {
    pub source_kind: String,
    pub semantic_family: String,
    pub mirror_raw_u32: u32,
    pub mirror_raw_hex: String,
    pub mirror_value_f32_text: String,
    pub lane_raw_u32: Vec<u32>,
    pub lane_raw_hex: Vec<String>,
    pub lane_value_f32_text: Vec<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SmpLoadedWorldFinanceNeighborhoodState {
    pub source_kind: String,
    pub semantic_family: String,
    pub packed_year_word_raw_u16: u16,
    pub packed_year_word_raw_hex: String,
    pub partial_year_progress_raw_u8: u8,
    pub partial_year_progress_raw_hex: String,
    pub current_calendar_tuple_word_raw_u32: u32,
    pub current_calendar_tuple_word_raw_hex: String,
    pub current_calendar_tuple_word_2_raw_u32: u32,
    pub current_calendar_tuple_word_2_raw_hex: String,
    pub absolute_counter_raw_u32: u32,
    pub absolute_counter_raw_hex: String,
    pub absolute_counter_mirror_raw_u32: u32,
    pub absolute_counter_mirror_raw_hex: String,
    pub stock_policy_raw_u8: u8,
    pub stock_policy_raw_hex: String,
    pub bond_policy_raw_u8: u8,
    pub bond_policy_raw_hex: String,
    pub bankruptcy_policy_raw_u8: u8,
    pub bankruptcy_policy_raw_hex: String,
    pub dividend_policy_raw_u8: u8,
    pub dividend_policy_raw_hex: String,
    pub building_density_growth_setting_raw_u32: u32,
    pub building_density_growth_setting_raw_hex: String,
    pub labels: Vec<String>,
    pub relative_offsets: Vec<usize>,
    pub relative_offset_hex: Vec<String>,
    pub raw_u32: Vec<u32>,
    pub raw_hex: Vec<String>,
    pub value_i32: Vec<i32>,
    pub value_f32_text: Vec<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SmpLoadedWorldLocomotivePolicyState {
    pub source_kind: String,
    pub semantic_family: String,
    #[serde(default)]
    pub selected_year_gap_scalar_raw_u32: Option<u32>,
    #[serde(default)]
    pub selected_year_gap_scalar_raw_hex: Option<String>,
    #[serde(default)]
    pub selected_year_gap_scalar_value_f32_text: Option<String>,
    #[serde(default)]
    pub linked_site_removal_follow_on_gate_raw_u8: Option<u8>,
    #[serde(default)]
    pub linked_site_removal_follow_on_gate_raw_hex: Option<String>,
    #[serde(default)]
    pub auto_show_grade_during_track_lay_raw_u8: Option<u8>,
    #[serde(default)]
    pub auto_show_grade_during_track_lay_raw_hex: Option<String>,
    #[serde(default)]
    pub starting_building_density_level_raw_u8: Option<u8>,
    #[serde(default)]
    pub starting_building_density_level_raw_hex: Option<String>,
    #[serde(default)]
    pub building_density_growth_raw_u8: Option<u8>,
    #[serde(default)]
    pub building_density_growth_raw_hex: Option<String>,
    #[serde(default)]
    pub leftover_simulation_time_accumulator_raw_u32: Option<u32>,
    #[serde(default)]
    pub leftover_simulation_time_accumulator_raw_hex: Option<String>,
    #[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 selected_year_lane_snapshot_raw_hex: Option<String>,
    #[serde(default)]
    pub all_steam_locomotives_available_raw_u8: Option<u8>,
    #[serde(default)]
    pub all_steam_locomotives_available_raw_hex: Option<String>,
    #[serde(default)]
    pub all_diesel_locomotives_available_raw_u8: Option<u8>,
    #[serde(default)]
    pub all_diesel_locomotives_available_raw_hex: Option<String>,
    #[serde(default)]
    pub all_electric_locomotives_available_raw_u8: Option<u8>,
    #[serde(default)]
    pub all_electric_locomotives_available_raw_hex: Option<String>,
    #[serde(default)]
    pub cached_available_locomotive_rating_raw_u32: Option<u32>,
    #[serde(default)]
    pub cached_available_locomotive_rating_raw_hex: Option<String>,
    #[serde(default)]
    pub cached_available_locomotive_rating_value_f32_text: Option<String>,
}
