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

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "SwapArgs")]
pub struct SwapArgsGraphQL {
    pub amount_in: U64,
    pub expect_amount_out: U64,
    pub min_return: U64,
    pub amounts: Vec<U64>,
    pub routes: Vec<Vec<RouteGraphQL>>,
}

impl From<crate::types::SwapArgs> for SwapArgsGraphQL {
    fn from(original: crate::types::SwapArgs) -> Self {
        Self {
            amount_in: carbon_core::graphql::primitives::U64(original.amount_in),
            expect_amount_out: carbon_core::graphql::primitives::U64(original.expect_amount_out),
            min_return: carbon_core::graphql::primitives::U64(original.min_return),
            amounts: original
                .amounts
                .into_iter()
                .map(carbon_core::graphql::primitives::U64)
                .collect(),
            routes: original
                .routes
                .into_iter()
                .map(|item| item.into_iter().map(|item| item.into()).collect())
                .collect(),
        }
    }
}
