//! This code was AUTOGENERATED using the Codama library.
pub mod close_position_schema;
pub mod collect_fund_fee_schema;
pub mod collect_protocol_fee_schema;
pub mod collect_remaining_rewards_schema;
pub mod cpi_event_schema;
pub mod create_amm_config_schema;
pub mod create_operation_account_schema;
pub mod create_permissionless_farm_switch_schema;
pub mod create_pool_schema;
pub mod create_support_mint_associated_schema;
pub mod decrease_liquidity_schema;
pub mod decrease_liquidity_v2_schema;
pub mod increase_liquidity_schema;
pub mod increase_liquidity_v2_schema;
pub mod initialize_reward_schema;
pub mod open_position_schema;
pub mod open_position_v2_schema;
pub mod open_position_with_token22_nft_schema;
pub mod set_reward_params_schema;
pub mod swap_router_base_in_schema;
pub mod swap_schema;
pub mod swap_v2_schema;
pub mod toggle_permissionless_farm_switch_schema;
pub mod transfer_reward_owner_schema;
pub mod update_amm_config_schema;
pub mod update_operation_account_schema;
pub mod update_pool_status_schema;
pub mod update_reward_infos_schema;

use juniper::GraphQLObject;
pub use {
    close_position_schema::*, collect_fund_fee_schema::*, collect_protocol_fee_schema::*,
    collect_remaining_rewards_schema::*, cpi_event_schema::*, create_amm_config_schema::*,
    create_operation_account_schema::*, create_permissionless_farm_switch_schema::*,
    create_pool_schema::*, create_support_mint_associated_schema::*, decrease_liquidity_schema::*,
    decrease_liquidity_v2_schema::*, increase_liquidity_schema::*, increase_liquidity_v2_schema::*,
    initialize_reward_schema::*, open_position_schema::*, open_position_v2_schema::*,
    open_position_with_token22_nft_schema::*, set_reward_params_schema::*,
    swap_router_base_in_schema::*, swap_schema::*, swap_v2_schema::*,
    toggle_permissionless_farm_switch_schema::*, transfer_reward_owner_schema::*,
    update_amm_config_schema::*, update_operation_account_schema::*, update_pool_status_schema::*,
    update_reward_infos_schema::*,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "InstructionMetadata")]
pub struct InstructionMetadataGraphQL {
    pub signature: String,
    pub instruction_index: carbon_core::graphql::primitives::U32,
    pub stack_height: carbon_core::graphql::primitives::U32,
    pub slot: Option<carbon_core::graphql::primitives::U64>,
}

impl From<carbon_core::postgres::metadata::InstructionRowMetadata> for InstructionMetadataGraphQL {
    fn from(metadata: carbon_core::postgres::metadata::InstructionRowMetadata) -> Self {
        Self {
            signature: metadata.signature,
            instruction_index: carbon_core::graphql::primitives::U32(
                (*metadata.instruction_index) as u32,
            ),
            stack_height: carbon_core::graphql::primitives::U32((*metadata.stack_height) as u32),
            slot: metadata
                .slot
                .map(|v| carbon_core::graphql::primitives::U64(*v)),
        }
    }
}
