//! This code was AUTOGENERATED using the Codama library.
pub mod add_assets_to_group_v1_schema;
pub mod add_collection_external_plugin_adapter_v1_schema;
pub mod add_collection_plugin_v1_schema;
pub mod add_collections_to_group_v1_schema;
pub mod add_external_plugin_adapter_v1_schema;
pub mod add_groups_to_group_v1_schema;
pub mod add_plugin_v1_schema;
pub mod approve_collection_plugin_authority_v1_schema;
pub mod approve_plugin_authority_v1_schema;
pub mod burn_collection_v1_schema;
pub mod burn_v1_schema;
pub mod close_group_v1_schema;
pub mod collect_schema;
pub mod compress_v1_schema;
pub mod create_collection_v1_schema;
pub mod create_collection_v2_schema;
pub mod create_group_v1_schema;
pub mod create_v1_schema;
pub mod create_v2_schema;
pub mod decompress_v1_schema;
pub mod execute_v1_schema;
pub mod remove_assets_from_group_v1_schema;
pub mod remove_collection_external_plugin_adapter_v1_schema;
pub mod remove_collection_plugin_v1_schema;
pub mod remove_collections_from_group_v1_schema;
pub mod remove_external_plugin_adapter_v1_schema;
pub mod remove_groups_from_group_v1_schema;
pub mod remove_plugin_v1_schema;
pub mod revoke_collection_plugin_authority_v1_schema;
pub mod revoke_plugin_authority_v1_schema;
pub mod transfer_v1_schema;
pub mod update_collection_external_plugin_adapter_v1_schema;
pub mod update_collection_info_v1_schema;
pub mod update_collection_plugin_v1_schema;
pub mod update_collection_v1_schema;
pub mod update_external_plugin_adapter_v1_schema;
pub mod update_group_v1_schema;
pub mod update_plugin_v1_schema;
pub mod update_v1_schema;
pub mod update_v2_schema;
pub mod write_collection_external_plugin_adapter_data_v1_schema;
pub mod write_external_plugin_adapter_data_v1_schema;

use juniper::GraphQLObject;
pub use {
    add_assets_to_group_v1_schema::*, add_collection_external_plugin_adapter_v1_schema::*,
    add_collection_plugin_v1_schema::*, add_collections_to_group_v1_schema::*,
    add_external_plugin_adapter_v1_schema::*, add_groups_to_group_v1_schema::*,
    add_plugin_v1_schema::*, approve_collection_plugin_authority_v1_schema::*,
    approve_plugin_authority_v1_schema::*, burn_collection_v1_schema::*, burn_v1_schema::*,
    close_group_v1_schema::*, collect_schema::*, compress_v1_schema::*,
    create_collection_v1_schema::*, create_collection_v2_schema::*, create_group_v1_schema::*,
    create_v1_schema::*, create_v2_schema::*, decompress_v1_schema::*, execute_v1_schema::*,
    remove_assets_from_group_v1_schema::*, remove_collection_external_plugin_adapter_v1_schema::*,
    remove_collection_plugin_v1_schema::*, remove_collections_from_group_v1_schema::*,
    remove_external_plugin_adapter_v1_schema::*, remove_groups_from_group_v1_schema::*,
    remove_plugin_v1_schema::*, revoke_collection_plugin_authority_v1_schema::*,
    revoke_plugin_authority_v1_schema::*, transfer_v1_schema::*,
    update_collection_external_plugin_adapter_v1_schema::*, update_collection_info_v1_schema::*,
    update_collection_plugin_v1_schema::*, update_collection_v1_schema::*,
    update_external_plugin_adapter_v1_schema::*, update_group_v1_schema::*,
    update_plugin_v1_schema::*, update_v1_schema::*, update_v2_schema::*,
    write_collection_external_plugin_adapter_data_v1_schema::*,
    write_external_plugin_adapter_data_v1_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)),
        }
    }
}
