//! 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 CollectPersonalFeeEventEvent {
    /// The ID of the token for which underlying tokens were collected
    pub position_nft_mint: Pubkey,
    /// The token account that received the collected token_0 tokens
    pub recipient_token_account0: Pubkey,
    /// The token account that received the collected token_1 tokens
    pub recipient_token_account1: Pubkey,
    /// The amount of token_0 owed to the position that was collected
    pub amount0: u64,
    /// The amount of token_1 owed to the position that was collected
    pub amount1: u64,
}

impl CollectPersonalFeeEventEvent {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [166, 174, 105, 192, 81, 161, 83, 105] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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