use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum BattleSize {
Incursion,
StrikeForce,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum WarningCode {
FactionUnresolved,
UnitUnresolved,
WeaponUnresolved,
EnhancementUnresolved,
DetachmentUnresolved,
BattleSizeUnmapped,
PointsMismatch,
LeaderAttachmentInferred,
MultiForce,
UnknownField,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Candidate {
pub id: String,
pub name: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ResolvedRef {
pub id: Option<String>,
pub raw_name: String,
pub resolved: bool,
pub candidates: Vec<Candidate>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RosterWargear {
#[serde(rename = "ref")]
pub ref_: ResolvedRef,
pub count: u64,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RosterLeaderAttachment {
pub bodyguard_ref: ResolvedRef,
pub provisional: bool,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RosterUnit {
#[serde(rename = "ref")]
pub ref_: ResolvedRef,
pub model_count: u64,
pub points: Option<u64>,
pub is_warlord: bool,
pub enhancement: Option<ResolvedRef>,
pub wargear: Vec<RosterWargear>,
pub leader_attachment: Option<RosterLeaderAttachment>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RosterSource {
pub format: String,
pub generated_by: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RosterPoints {
pub declared_limit: Option<u64>,
pub total_reported: Option<u64>,
pub total_computed: u64,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Warning {
pub code: WarningCode,
pub message: String,
pub raw_name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Diagnostics {
pub resolved_units: u64,
pub unresolved_units: u64,
pub resolved_weapons: u64,
pub unresolved_weapons: u64,
pub warnings: Vec<Warning>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct GameVersionRef {
pub edition: String,
pub dataslate: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Roster {
pub name: String,
pub source: RosterSource,
pub faction_id: Option<String>,
pub detachment_id: Option<String>,
pub battle_size: Option<BattleSize>,
pub points: RosterPoints,
pub units: Vec<RosterUnit>,
pub game_version: GameVersionRef,
pub diagnostics: Diagnostics,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ParsedWargear {
pub raw_name: String,
pub count: u64,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ParsedUnit {
pub raw_name: String,
pub is_character: bool,
pub model_count: u64,
pub points: Option<u64>,
pub is_warlord: bool,
pub enhancement_raw_name: Option<String>,
pub wargear: Vec<ParsedWargear>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ParsedRoster {
pub name: String,
pub generated_by: Option<String>,
pub faction_raw_name: Option<String>,
pub detachment_raw_name: Option<String>,
pub battle_size_raw: Option<String>,
pub declared_limit: Option<u64>,
pub total_reported: Option<u64>,
pub total_computed: u64,
pub units: Vec<ParsedUnit>,
pub multi_force: bool,
}