#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(i32)]
pub enum EChatPermission {
    Close = 1,
    Invite = 2,
    Talk = 8,
    Kick = 16,
    Mute = 32,
    SetMetadata = 64,
    ChangePermissions = 128,
    Ban = 256,
    ChangeAccess = 512,
    Mask = 1019,
}

impl EChatPermission {
    pub fn from_i32(val: i32) -> Option<Self> {
        match val {
            x if x == Self::Close as i32 => Some(Self::Close),
            x if x == Self::Invite as i32 => Some(Self::Invite),
            x if x == Self::Talk as i32 => Some(Self::Talk),
            x if x == Self::Kick as i32 => Some(Self::Kick),
            x if x == Self::Mute as i32 => Some(Self::Mute),
            x if x == Self::SetMetadata as i32 => Some(Self::SetMetadata),
            x if x == Self::ChangePermissions as i32 => Some(Self::ChangePermissions),
            x if x == Self::Ban as i32 => Some(Self::Ban),
            x if x == Self::ChangeAccess as i32 => Some(Self::ChangeAccess),
            x if x == Self::Mask as i32 => Some(Self::Mask),
            _ => None,
        }
    }
}
