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

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "SwapWithFeesCpiEvent")]
pub struct SwapWithFeesCpiEventGraphQL {
    pub order_id: U64,
    pub source_mint: Pubkey,
    pub destination_mint: Pubkey,
    pub source_token_account_owner: Pubkey,
    pub destination_token_account_owner: Pubkey,
    pub amount_in: U64,
    pub source_token_change: U64,
    pub destination_token_change: U64,
    pub commission_direction: bool,
    pub commission_rate: U32,
    pub commission_amount: U64,
    pub commission_account: Pubkey,
    pub platform_fee_rate: i32,
    pub platform_fee_amount: U64,
    pub platform_fee_account: Pubkey,
    pub trim_rate: U8,
    pub trim_amount: U64,
    pub trim_account: Pubkey,
}

impl From<crate::types::SwapWithFeesCpiEvent> for SwapWithFeesCpiEventGraphQL {
    fn from(original: crate::types::SwapWithFeesCpiEvent) -> Self {
        Self {
            order_id: carbon_core::graphql::primitives::U64(original.order_id),
            source_mint: carbon_core::graphql::primitives::Pubkey(original.source_mint),
            destination_mint: carbon_core::graphql::primitives::Pubkey(original.destination_mint),
            source_token_account_owner: carbon_core::graphql::primitives::Pubkey(
                original.source_token_account_owner,
            ),
            destination_token_account_owner: carbon_core::graphql::primitives::Pubkey(
                original.destination_token_account_owner,
            ),
            amount_in: carbon_core::graphql::primitives::U64(original.amount_in),
            source_token_change: carbon_core::graphql::primitives::U64(
                original.source_token_change,
            ),
            destination_token_change: carbon_core::graphql::primitives::U64(
                original.destination_token_change,
            ),
            commission_direction: original.commission_direction,
            commission_rate: carbon_core::graphql::primitives::U32(original.commission_rate),
            commission_amount: carbon_core::graphql::primitives::U64(original.commission_amount),
            commission_account: carbon_core::graphql::primitives::Pubkey(
                original.commission_account,
            ),
            platform_fee_rate: original.platform_fee_rate as i32,
            platform_fee_amount: carbon_core::graphql::primitives::U64(
                original.platform_fee_amount,
            ),
            platform_fee_account: carbon_core::graphql::primitives::Pubkey(
                original.platform_fee_account,
            ),
            trim_rate: carbon_core::graphql::primitives::U8(original.trim_rate),
            trim_amount: carbon_core::graphql::primitives::U64(original.trim_amount),
            trim_account: carbon_core::graphql::primitives::Pubkey(original.trim_account),
        }
    }
}
