//! This code was AUTOGENERATED using the Codama library.
use {
    carbon_core::graphql::primitives::{Pubkey, U128, U64},
    juniper::GraphQLObject,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "DecreaseLiquidityEvent")]
pub struct DecreaseLiquidityEventGraphQL {
    pub position_nft_mint: Pubkey,
    pub liquidity: U128,
    pub decrease_amount0: U64,
    pub decrease_amount1: U64,
    pub fee_amount0: U64,
    pub fee_amount1: U64,
    pub reward_amounts: Vec<U64>,
    pub transfer_fee0: U64,
    pub transfer_fee1: U64,
}

impl From<crate::types::DecreaseLiquidityEvent> for DecreaseLiquidityEventGraphQL {
    fn from(original: crate::types::DecreaseLiquidityEvent) -> Self {
        Self {
            position_nft_mint: carbon_core::graphql::primitives::Pubkey(original.position_nft_mint),
            liquidity: carbon_core::graphql::primitives::U128(original.liquidity),
            decrease_amount0: carbon_core::graphql::primitives::U64(original.decrease_amount0),
            decrease_amount1: carbon_core::graphql::primitives::U64(original.decrease_amount1),
            fee_amount0: carbon_core::graphql::primitives::U64(original.fee_amount0),
            fee_amount1: carbon_core::graphql::primitives::U64(original.fee_amount1),
            reward_amounts: original
                .reward_amounts
                .into_iter()
                .map(carbon_core::graphql::primitives::U64)
                .collect(),
            transfer_fee0: carbon_core::graphql::primitives::U64(original.transfer_fee0),
            transfer_fee1: carbon_core::graphql::primitives::U64(original.transfer_fee1),
        }
    }
}
