use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
pub struct RecentKillmail {
  pub killmail_hash: String,
  pub killmail_id: i32,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct Killmail {
  pub attackers: Vec<Attacker>,
  pub killmail_id: i32,
  pub killmail_time: DateTime<Utc>,
  pub moon_id: Option<i32>,
  pub solar_system_id: i32,
  pub victim: Victim,
  pub war_id: Option<i32>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct Attacker {
  pub alliance_id: Option<i32>,
  pub character_id: Option<i32>,
  pub corporation_id: Option<i32>,
  pub damage_done: i32,
  pub faction_id: Option<i32>,
  pub final_blow: bool,
  pub security_status: f32,
  pub ship_type_id: Option<i32>,
  pub weapon_type_id: Option<i32>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct Victim {
  pub alliance_id: Option<i32>,
  pub character_id: Option<i32>,
  pub corporation_id: Option<i32>,
  pub damage_taken: i32,
  pub faction_id: Option<i32>,
  pub items: Option<Vec<VictimItem>>,
  pub position: VictimPosition,
  pub ship_type_id: i32,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct VictimItem {
  pub flag: i32,
  pub item_type_id: i32,
  pub items: Option<Vec<VictimItem>>,
  pub quantity_destroyed: Option<i64>,
  pub quantity_dropped: Option<i64>,
  pub singleton: i32,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct VictimPosition {
  pub x: f32,
  pub y: f32,
  pub z: f32,
}
