#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(i32)]
pub enum EUdpPacketType {
    Invalid = 0,
    ChallengeReq = 1,
    Challenge = 2,
    Connect = 3,
    Accept = 4,
    Disconnect = 5,
    Data = 6,
    Datagram = 7,
    Max = 8,
}

impl EUdpPacketType {
    pub fn from_i32(val: i32) -> Option<Self> {
        match val {
            x if x == Self::Invalid as i32 => Some(Self::Invalid),
            x if x == Self::ChallengeReq as i32 => Some(Self::ChallengeReq),
            x if x == Self::Challenge as i32 => Some(Self::Challenge),
            x if x == Self::Connect as i32 => Some(Self::Connect),
            x if x == Self::Accept as i32 => Some(Self::Accept),
            x if x == Self::Disconnect as i32 => Some(Self::Disconnect),
            x if x == Self::Data as i32 => Some(Self::Data),
            x if x == Self::Datagram as i32 => Some(Self::Datagram),
            x if x == Self::Max as i32 => Some(Self::Max),
            _ => None,
        }
    }
}
