//! Data extracted from a saved recording.

use std::collections::BTreeMap;

#[derive(Clone, Debug)]
pub struct Handling {
    pub arr: f64,
    pub das: f64,
    pub dcd: i32,
    pub sdf: i32,
    pub safelock: bool,
    pub cancel: bool,
    pub may20g: bool,
    pub irs: String,
    pub ihs: String,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum KeyKind {
    KeyDown,
    KeyUp,
}

#[derive(Clone, Debug)]
pub struct KeyEvent {
    pub frame: i32,
    pub subframe: f64,
    pub kind: KeyKind,
    pub key: String,
    pub hoisted: bool,
}

#[derive(Clone, Debug)]
pub struct Replay {
    pub replay_id: String,
    pub gamemode: String,
    pub timestamp: String,
    pub username: String,
    pub seed: i64,
    pub handling: Handling,
    pub total_frames: i32,
    pub key_events: Vec<KeyEvent>,
    pub pieces_placed: u32,
    pub lines_cleared: u32,
    pub clear_stats: BTreeMap<String, i64>,
    pub final_time_ms: i64,
    pub inputs: i64,
    pub allow_180: bool,
    pub nolockout: bool,
    pub pro: bool,
    pub stride: bool,
    pub no_szo: bool,
    pub levels: bool,
    pub levelgbase: f64,
    pub levelgspeed: f64,
    pub gravity_may20g: bool,
}
