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

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "SwapEvent")]
pub struct SwapEventGraphQL {
    pub pool_state: Pubkey,
    pub sender: Pubkey,
    pub token_account0: Pubkey,
    pub token_account1: Pubkey,
    pub amount0: U64,
    pub transfer_fee0: U64,
    pub amount1: U64,
    pub transfer_fee1: U64,
    pub zero_for_one: bool,
    pub sqrt_price_x64: U128,
    pub liquidity: U128,
    pub tick: i32,
}

impl From<crate::types::SwapEvent> for SwapEventGraphQL {
    fn from(original: crate::types::SwapEvent) -> Self {
        Self {
            pool_state: carbon_core::graphql::primitives::Pubkey(original.pool_state),
            sender: carbon_core::graphql::primitives::Pubkey(original.sender),
            token_account0: carbon_core::graphql::primitives::Pubkey(original.token_account0),
            token_account1: carbon_core::graphql::primitives::Pubkey(original.token_account1),
            amount0: carbon_core::graphql::primitives::U64(original.amount0),
            transfer_fee0: carbon_core::graphql::primitives::U64(original.transfer_fee0),
            amount1: carbon_core::graphql::primitives::U64(original.amount1),
            transfer_fee1: carbon_core::graphql::primitives::U64(original.transfer_fee1),
            zero_for_one: original.zero_for_one,
            sqrt_price_x64: carbon_core::graphql::primitives::U128(original.sqrt_price_x64),
            liquidity: carbon_core::graphql::primitives::U128(original.liquidity),
            tick: original.tick,
        }
    }
}
