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

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "AgentIdentityInitInfo")]
pub struct AgentIdentityInitInfoGraphQL {
    pub uri: String,
    pub init_plugin_authority: Option<AuthorityGraphQL>,
    pub lifecycle_checks: Vec<Json>,
}

impl From<crate::types::AgentIdentityInitInfo> for AgentIdentityInitInfoGraphQL {
    fn from(original: crate::types::AgentIdentityInitInfo) -> Self {
        Self {
            uri: original.uri,
            init_plugin_authority: original.init_plugin_authority.map(|v| v.into()),
            lifecycle_checks: original
                .lifecycle_checks
                .into_iter()
                .map(|item| {
                    carbon_core::graphql::primitives::Json(
                        serde_json::to_value(item).unwrap_or(serde_json::Value::Null),
                    )
                })
                .collect(),
        }
    }
}
