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

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "CompressionProof")]
pub struct CompressionProofGraphQL {
    pub owner: Pubkey,
    pub update_authority: UpdateAuthorityGraphQL,
    pub name: String,
    pub uri: String,
    pub seq: U64,
    pub plugins: Vec<HashablePluginSchemaGraphQL>,
}

impl From<crate::types::CompressionProof> for CompressionProofGraphQL {
    fn from(original: crate::types::CompressionProof) -> Self {
        Self {
            owner: carbon_core::graphql::primitives::Pubkey(original.owner),
            update_authority: original.update_authority.into(),
            name: original.name,
            uri: original.uri,
            seq: carbon_core::graphql::primitives::U64(original.seq),
            plugins: original
                .plugins
                .into_iter()
                .map(|item| item.into())
                .collect(),
        }
    }
}
