//! 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 CreatePersonalPositionEventEvent {
    /// The pool for which liquidity was added
    pub pool_state: Pubkey,
    /// The address that create the position
    pub minter: Pubkey,
    /// The owner of the position and recipient of any minted liquidity
    pub nft_owner: Pubkey,
    /// The lower tick of the position
    pub tick_lower_index: i32,
    /// The upper tick of the position
    pub tick_upper_index: i32,
    /// The amount of liquidity minted to the position range
    pub liquidity: u128,
    /// The amount of token_0 was deposit for the liquidity
    pub deposit_amount0: u64,
    /// The amount of token_1 was deposit for the liquidity
    pub deposit_amount1: u64,
    /// The token transfer fee for deposit_amount_0
    pub deposit_amount0_transfer_fee: u64,
    /// The token transfer fee for deposit_amount_1
    pub deposit_amount1_transfer_fee: u64,
}

impl CreatePersonalPositionEventEvent {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [100, 30, 87, 249, 196, 223, 154, 206] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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