//! This code was AUTOGENERATED using the Codama library.

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct LiquidityCalculateEventEvent {
    /// The pool liquidity before decrease or increase
    pub pool_liquidity: u128,
    /// The pool price when decrease or increase in liquidity
    pub pool_sqrt_price_x64: u128,
    /// The pool tick when decrease or increase in liquidity
    pub pool_tick: i32,
    /// The amount of token_0 that was calculated for the decrease or increase
    /// in liquidity
    pub calc_amount0: u64,
    /// The amount of token_1 that was calculated for the decrease or increase
    /// in liquidity
    pub calc_amount1: u64,
    pub trade_fee_owed0: u64,
    /// The amount of token_1 fee
    pub trade_fee_owed1: u64,
    /// The amount of token_0 transfer fee without trade_fee_amount_0
    pub transfer_fee0: u64,
    /// The amount of token_1 transfer fee without trade_fee_amount_0
    pub transfer_fee1: u64,
}

impl LiquidityCalculateEventEvent {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [237, 112, 148, 230, 57, 84, 180, 162] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
    }
}
