use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SmpSavePlacedStructureRecordTripletEntryProbe {
    pub record_index: usize,
    pub primary_name: String,
    pub secondary_name: String,
    pub name_tag_relative_offset: usize,
    pub policy_tag_relative_offset: usize,
    pub profile_tag_relative_offset: usize,
    pub policy_chunk_len: usize,
    pub profile_chunk_len: usize,
    pub policy_f32_lane_0: f32,
    pub policy_f32_lane_1: f32,
    pub policy_f32_lane_2: f32,
    pub policy_f32_lane_3: f32,
    pub policy_f32_lane_4: f32,
    pub policy_reserved_dword: u32,
    pub policy_trailing_word: u16,
    pub policy_trailing_word_hex: String,
    pub profile_open_marker: u32,
    pub profile_open_marker_hex: String,
    pub profile_repeated_primary_name: String,
    pub profile_repeated_secondary_name: String,
    pub profile_footer_relative_offset: usize,
    pub profile_footer_relative_offset_hex: String,
    pub profile_pre_footer_padding_len: usize,
    #[serde(default)]
    pub profile_pre_footer_padding_hex_bytes: Vec<String>,
    #[serde(default)]
    pub profile_companion_byte_u8: Option<u8>,
    #[serde(default)]
    pub profile_companion_byte_hex: Option<String>,
    pub profile_payload_dword: u32,
    pub profile_payload_dword_hex: String,
    pub profile_sentinel_i32: i32,
    pub profile_status_kind: String,
    pub farm_growth_stage_index: Option<u8>,
    pub profile_close_marker: u32,
    pub profile_close_marker_hex: String,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SmpSavePlacedStructureRecordTripletProbe {
    pub profile_family: String,
    pub source_kind: String,
    pub semantic_family: String,
    pub records_tag_offset: usize,
    pub close_tag_offset: usize,
    pub record_count: usize,
    #[serde(default)]
    pub entries: Vec<SmpSavePlacedStructureRecordTripletEntryProbe>,
    pub evidence: Vec<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SmpLoadedPlacedStructureEntry {
    pub record_index: usize,
    pub primary_name: String,
    pub secondary_name: String,
    pub policy_trailing_word: u16,
    pub policy_trailing_word_hex: String,
    pub profile_payload_dword: u32,
    pub profile_payload_dword_hex: String,
    pub profile_status_kind: String,
    #[serde(default)]
    pub farm_growth_stage_index: Option<u8>,
    #[serde(default)]
    pub profile_companion_byte_u8: Option<u8>,
    #[serde(default)]
    pub profile_companion_byte_hex: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SmpLoadedPlacedStructureCollection {
    pub source_kind: String,
    pub semantic_family: String,
    pub observed_entry_count: usize,
    #[serde(default)]
    pub entries: Vec<SmpLoadedPlacedStructureEntry>,
}
