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

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "OracleUpdateInfo")]
pub struct OracleUpdateInfoGraphQL {
    pub lifecycle_checks: Option<Vec<Json>>,
    pub base_address_config: Option<ExtraAccountGraphQL>,
    pub results_offset: Option<ValidationResultsOffsetGraphQL>,
}

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