#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(i32)]
pub enum EDemoCommands {
    Error = -1,
    Stop = 0,
    FileHeader = 1,
    FileInfo = 2,
    SyncTick = 3,
    SendTables = 4,
    ClassInfo = 5,
    StringTables = 6,
    Packet = 7,
    SignonPacket = 8,
    ConsoleCmd = 9,
    CustomData = 10,
    CustomDataCallbacks = 11,
    UserCmd = 12,
    FullPacket = 13,
    SaveGame = 14,
    SpawnGroups = 15,
    AnimationData = 16,
    AnimationHeader = 17,
    Recovery = 18,
    Max = 19,
    IsCompressed = 64,
}

impl EDemoCommands {
    pub fn from_i32(val: i32) -> Option<Self> {
        match val {
            x if x == Self::Error as i32 => Some(Self::Error),
            x if x == Self::Stop as i32 => Some(Self::Stop),
            x if x == Self::FileHeader as i32 => Some(Self::FileHeader),
            x if x == Self::FileInfo as i32 => Some(Self::FileInfo),
            x if x == Self::SyncTick as i32 => Some(Self::SyncTick),
            x if x == Self::SendTables as i32 => Some(Self::SendTables),
            x if x == Self::ClassInfo as i32 => Some(Self::ClassInfo),
            x if x == Self::StringTables as i32 => Some(Self::StringTables),
            x if x == Self::Packet as i32 => Some(Self::Packet),
            x if x == Self::SignonPacket as i32 => Some(Self::SignonPacket),
            x if x == Self::ConsoleCmd as i32 => Some(Self::ConsoleCmd),
            x if x == Self::CustomData as i32 => Some(Self::CustomData),
            x if x == Self::CustomDataCallbacks as i32 => Some(Self::CustomDataCallbacks),
            x if x == Self::UserCmd as i32 => Some(Self::UserCmd),
            x if x == Self::FullPacket as i32 => Some(Self::FullPacket),
            x if x == Self::SaveGame as i32 => Some(Self::SaveGame),
            x if x == Self::SpawnGroups as i32 => Some(Self::SpawnGroups),
            x if x == Self::AnimationData as i32 => Some(Self::AnimationData),
            x if x == Self::AnimationHeader as i32 => Some(Self::AnimationHeader),
            x if x == Self::Recovery as i32 => Some(Self::Recovery),
            x if x == Self::Max as i32 => Some(Self::Max),
            x if x == Self::IsCompressed as i32 => Some(Self::IsCompressed),
            _ => None,
        }
    }
}
