#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{GroupTable, Instances, InvalidValue, LazyKnownTags, Tag};
use super::super::enums::{DlvyInstType, SettlInstSource};
use super::SettlParties;
#[derive(Clone, Copy)]
pub struct DlvyInstGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for DlvyInstGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> DlvyInstGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(85),
Tag(165),
&[Tag(165), Tag(781), Tag(787)],
&[SettlParties::TABLE],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(165), Tag(787), Tag(781)],
&[SettlParties::known_tags()],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "SettlInstSource")]
pub fn settl_inst_source(&self) -> Result<Option<SettlInstSource<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(165))?.map(SettlInstSource::from_value))
}
#[doc(alias = "DlvyInstType")]
pub fn dlvy_inst_type(&self) -> Result<Option<DlvyInstType<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(787))?.map(DlvyInstType::from_value))
}
#[doc(alias = "NoSettlPartyIDs")]
pub fn settl_party_ids(&self) -> Result<Instances<'a, SettlParties<'a>>, InvalidValue> {
self.0.get_group(&SettlParties::TABLE, &Self::known_tags().get()).map(Instances::from)
}
}
impl std::fmt::Debug for DlvyInstGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "DlvyInstGrp({})", self.0)
}
}