use alloc::borrow::Cow;
use alloc::vec::Vec;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use crate::models::{requests::RequestMethod, Model};
use super::{CommonFields, LedgerIndex, LookupByLedgerRequest, Request};
#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
pub struct GatewayBalances<'a> {
#[serde(flatten)]
pub common_fields: CommonFields<'a>,
pub account: Cow<'a, str>,
pub hotwallet: Option<Vec<Cow<'a, str>>>,
#[serde(flatten)]
pub ledger_lookup: Option<LookupByLedgerRequest<'a>>,
pub strict: Option<bool>,
}
impl<'a> Model for GatewayBalances<'a> {}
impl<'a> Request<'a> for GatewayBalances<'a> {
fn get_common_fields(&self) -> &CommonFields<'a> {
&self.common_fields
}
fn get_common_fields_mut(&mut self) -> &mut CommonFields<'a> {
&mut self.common_fields
}
}
impl<'a> GatewayBalances<'a> {
pub fn new(
id: Option<Cow<'a, str>>,
account: Cow<'a, str>,
hotwallet: Option<Vec<Cow<'a, str>>>,
ledger_hash: Option<Cow<'a, str>>,
ledger_index: Option<LedgerIndex<'a>>,
strict: Option<bool>,
) -> Self {
Self {
common_fields: CommonFields {
command: RequestMethod::GatewayBalances,
id,
},
account,
strict,
ledger_lookup: Some(LookupByLedgerRequest {
ledger_hash,
ledger_index,
}),
hotwallet,
}
}
}