//! This code was AUTOGENERATED using the Codama library.
pub mod asset_v1_schema;
pub mod collection_v1_schema;
pub mod group_v1_schema;
pub mod hashed_asset_v1_schema;
pub mod plugin_header_v1_schema;
pub mod plugin_registry_v1_schema;

use juniper::GraphQLObject;
pub use {
    asset_v1_schema::*, collection_v1_schema::*, group_v1_schema::*, hashed_asset_v1_schema::*,
    plugin_header_v1_schema::*, plugin_registry_v1_schema::*,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "AccountMetadata")]
pub struct AccountMetadataGraphQL {
    pub pubkey: carbon_core::graphql::primitives::Pubkey,
    pub slot: Option<carbon_core::graphql::primitives::U64>,
}

impl From<carbon_core::postgres::metadata::AccountRowMetadata> for AccountMetadataGraphQL {
    fn from(metadata: carbon_core::postgres::metadata::AccountRowMetadata) -> Self {
        Self {
            pubkey: carbon_core::graphql::primitives::Pubkey(*metadata.pubkey),
            slot: metadata
                .slot
                .map(|v| carbon_core::graphql::primitives::U64(*v)),
        }
    }
}
