#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(i32)]
pub enum EGCMsgResponse {
    OK = 0,
    Denied = 1,
    ServerError = 2,
    Timeout = 3,
    Invalid = 4,
    NoMatch = 5,
    UnknownError = 6,
    NotLoggedOn = 7,
    FailedToCreate = 8,
    LimitExceeded = 9,
    CommitUnfinalized = 10,
}

impl EGCMsgResponse {
    pub fn from_i32(val: i32) -> Option<Self> {
        match val {
            x if x == Self::OK as i32 => Some(Self::OK),
            x if x == Self::Denied as i32 => Some(Self::Denied),
            x if x == Self::ServerError as i32 => Some(Self::ServerError),
            x if x == Self::Timeout as i32 => Some(Self::Timeout),
            x if x == Self::Invalid as i32 => Some(Self::Invalid),
            x if x == Self::NoMatch as i32 => Some(Self::NoMatch),
            x if x == Self::UnknownError as i32 => Some(Self::UnknownError),
            x if x == Self::NotLoggedOn as i32 => Some(Self::NotLoggedOn),
            x if x == Self::FailedToCreate as i32 => Some(Self::FailedToCreate),
            x if x == Self::LimitExceeded as i32 => Some(Self::LimitExceeded),
            x if x == Self::CommitUnfinalized as i32 => Some(Self::CommitUnfinalized),
            _ => None,
        }
    }
}
