#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(i32)]
pub enum EChatMemberStateChange {
    Entered = 0x01,
    Left = 0x02,
    Disconnected = 0x04,
    Kicked = 0x08,
    Banned = 0x10,
    VoiceSpeaking = 0x1000,
    VoiceDoneSpeaking = 0x2000,
}

impl EChatMemberStateChange {
    pub fn from_i32(val: i32) -> Option<Self> {
        match val {
            x if x == Self::Entered as i32 => Some(Self::Entered),
            x if x == Self::Left as i32 => Some(Self::Left),
            x if x == Self::Disconnected as i32 => Some(Self::Disconnected),
            x if x == Self::Kicked as i32 => Some(Self::Kicked),
            x if x == Self::Banned as i32 => Some(Self::Banned),
            x if x == Self::VoiceSpeaking as i32 => Some(Self::VoiceSpeaking),
            x if x == Self::VoiceDoneSpeaking as i32 => Some(Self::VoiceDoneSpeaking),
            _ => None,
        }
    }
}
