#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(i32)]
pub enum ETradeOfferState {
    Invalid = 1,
    Active = 2,
    Accepted = 3,
    Countered = 4,
    Expired = 5,
    Canceled = 6,
    Declined = 7,
    InvalidItems = 8,
    CreatedNeedsConfirmation = 9,
    CanceledBySecondFactor = 10,
    InEscrow = 11,
    Reverted = 12,
}

impl ETradeOfferState {
    pub fn from_i32(val: i32) -> Option<Self> {
        match val {
            x if x == Self::Invalid as i32 => Some(Self::Invalid),
            x if x == Self::Active as i32 => Some(Self::Active),
            x if x == Self::Accepted as i32 => Some(Self::Accepted),
            x if x == Self::Countered as i32 => Some(Self::Countered),
            x if x == Self::Expired as i32 => Some(Self::Expired),
            x if x == Self::Canceled as i32 => Some(Self::Canceled),
            x if x == Self::Declined as i32 => Some(Self::Declined),
            x if x == Self::InvalidItems as i32 => Some(Self::InvalidItems),
            x if x == Self::CreatedNeedsConfirmation as i32 => Some(Self::CreatedNeedsConfirmation),
            x if x == Self::CanceledBySecondFactor as i32 => Some(Self::CanceledBySecondFactor),
            x if x == Self::InEscrow as i32 => Some(Self::InEscrow),
            x if x == Self::Reverted as i32 => Some(Self::Reverted),
            _ => None,
        }
    }
}
