//! This code was AUTOGENERATED using the Codama library.
use solana_pubkey::Pubkey;

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct CollectProtocolFeeEventEvent {
    /// The pool whose protocol fee is collected
    pub pool_state: Pubkey,
    /// The address that receives the collected token_0 protocol fees
    pub recipient_token_account0: Pubkey,
    /// The address that receives the collected token_1 protocol fees
    pub recipient_token_account1: Pubkey,
    /// The amount of token_0 protocol fees that is withdrawn
    pub amount0: u64,
    /// The amount of token_0 protocol fees that is withdrawn
    pub amount1: u64,
}

impl CollectProtocolFeeEventEvent {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [206, 87, 17, 79, 45, 41, 213, 61] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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