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

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "ConfigChangeEvent")]
pub struct ConfigChangeEventGraphQL {
    pub index: i32,
    pub owner: Pubkey,
    pub protocol_fee_rate: U32,
    pub trade_fee_rate: U32,
    pub tick_spacing: i32,
    pub fund_fee_rate: U32,
    pub fund_owner: Pubkey,
}

impl From<crate::types::ConfigChangeEvent> for ConfigChangeEventGraphQL {
    fn from(original: crate::types::ConfigChangeEvent) -> Self {
        Self {
            index: original.index as i32,
            owner: carbon_core::graphql::primitives::Pubkey(original.owner),
            protocol_fee_rate: carbon_core::graphql::primitives::U32(original.protocol_fee_rate),
            trade_fee_rate: carbon_core::graphql::primitives::U32(original.trade_fee_rate),
            tick_spacing: original.tick_spacing as i32,
            fund_fee_rate: carbon_core::graphql::primitives::U32(original.fund_fee_rate),
            fund_owner: carbon_core::graphql::primitives::Pubkey(original.fund_owner),
        }
    }
}
