use std::time::Duration;
use derive_new::new;
use getset::{CopyGetters, Getters};
use crate::packet::header::Header;
use crate::types::{Flag, VehicleIndex};
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum Formula {
ClassicF1,
GenericF1,
ModernF1,
F2,
}
impl Default for Formula {
fn default() -> Self {
Formula::ModernF1
}
}
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum SafetyCar {
None,
Full,
Virtual,
}
impl Default for SafetyCar {
fn default() -> Self {
SafetyCar::Full
}
}
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum Session {
OneShotQualifying,
P1,
P2,
P3,
Q1,
Q2,
Q3,
Race,
Race2,
ShortPractice,
ShortQualifying,
TimeTrial,
Unknown,
}
impl Default for Session {
fn default() -> Self {
Session::Unknown
}
}
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum Track {
AbuDhabi,
Austria,
Azerbaijan,
Bahrain,
BahrainShort,
Brazil,
Catalunya,
Hockenheim,
Hungaroring,
Melbourne,
Mexico,
Monaco,
Montreal,
Monza,
PaulRicard,
Shanghai,
Silverstone,
SilverstoneShort,
Singapore,
Sochi,
Spa,
Suzuka,
SuzukaShort,
Texas,
TexasShort,
Unknown,
}
impl Default for Track {
fn default() -> Self {
Track::Unknown
}
}
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum Weather {
Clear,
LightCloud,
Overcast,
LightRain,
HeavyRain,
Storm,
}
impl Default for Weather {
fn default() -> Self {
Weather::Clear
}
}
#[derive(new, Debug, CopyGetters, PartialEq, Copy, Clone, PartialOrd, Default)]
pub struct MarshalZone {
#[getset(get_copy = "pub")]
start: f32,
#[getset(get_copy = "pub")]
flag: Flag,
}
#[derive(new, Debug, CopyGetters, Getters, PartialEq, Clone, PartialOrd)]
#[allow(clippy::too_many_arguments)]
pub struct SessionPacket {
#[getset(get = "pub")]
header: Header,
#[getset(get_copy = "pub")]
weather: Weather,
#[getset(get_copy = "pub")]
track_temperature: i8,
#[getset(get_copy = "pub")]
air_temperature: i8,
#[getset(get_copy = "pub")]
total_laps: u8,
#[getset(get_copy = "pub")]
track_length: u16,
#[getset(get_copy = "pub")]
session_type: Session,
#[getset(get_copy = "pub")]
track: Track,
#[getset(get_copy = "pub")]
formula: Formula,
#[getset(get = "pub")]
time_left: Duration,
#[getset(get = "pub")]
duration: Duration,
#[getset(get_copy = "pub")]
pit_speed_limit: u8,
#[getset(get_copy = "pub")]
game_paused: bool,
#[getset(get_copy = "pub")]
is_spectating: bool,
#[getset(get_copy = "pub")]
spectator_car_index: VehicleIndex,
#[getset(get_copy = "pub")]
sli_pro_support: bool,
#[getset(get = "pub")]
marshal_zones: Vec<MarshalZone>,
#[getset(get_copy = "pub")]
safety_car: SafetyCar,
#[getset(get_copy = "pub")]
network_session: bool,
}