#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, Tag};
use super::NestedParties3;
#[derive(Clone, Copy)]
pub struct PreAllocMlegGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for PreAllocMlegGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> PreAllocMlegGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(78),
Tag(79),
&[Tag(79), Tag(80), Tag(467), Tag(661), Tag(736), Tag(948)],
&[NestedParties3::TABLE],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(79), Tag(661), Tag(736), Tag(467), Tag(948), Tag(80)],
&[NestedParties3::known_tags()],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "AllocAccount")]
pub fn alloc_account(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(79))
}
#[doc(alias = "AllocAcctIDSource")]
pub fn alloc_acct_id_source(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(661))
}
#[doc(alias = "AllocSettlCurrency")]
pub fn alloc_settl_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(736))
}
#[doc(alias = "IndividualAllocID")]
pub fn individual_alloc_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(467))
}
#[doc(alias = "NoNested3PartyIDs")]
pub fn nested3_party_ids(&self) -> Result<Instances<'a, NestedParties3<'a>>, InvalidValue> {
self.0.get_group(&NestedParties3::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "AllocQty")]
pub fn alloc_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(80))
}
}
impl std::fmt::Debug for PreAllocMlegGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "PreAllocMlegGrp({})", self.0)
}
}