#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, Tag};
use super::NestedParties2;
#[derive(Clone, Copy)]
pub struct LegPreAllocGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for LegPreAllocGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> LegPreAllocGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(670),
Tag(671),
&[Tag(671), Tag(672), Tag(673), Tag(674), Tag(675), Tag(756)],
&[NestedParties2::TABLE],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(671), Tag(672), Tag(756), Tag(673), Tag(674), Tag(675)],
&[NestedParties2::known_tags()],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "LegAllocAccount")]
pub fn leg_alloc_account(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(671))
}
#[doc(alias = "LegIndividualAllocID")]
pub fn leg_individual_alloc_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(672))
}
#[doc(alias = "NoNested2PartyIDs")]
pub fn nested2_party_ids(&self) -> Result<Instances<'a, NestedParties2<'a>>, InvalidValue> {
self.0.get_group(&NestedParties2::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "LegAllocQty")]
pub fn leg_alloc_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(673))
}
#[doc(alias = "LegAllocAcctIDSource")]
pub fn leg_alloc_acct_id_source(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(674))
}
#[doc(alias = "LegSettlCurrency")]
pub fn leg_settl_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(675))
}
}
impl std::fmt::Debug for LegPreAllocGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "LegPreAllocGrp({})", self.0)
}
}