#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Date, GroupTable, Instances, InvalidValue, LazyKnownTags, Tag};
use super::super::enums::OwnerType;
use super::NestedParties;
#[derive(Clone, Copy)]
pub struct RgstDtlsGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for RgstDtlsGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> RgstDtlsGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(473),
Tag(509),
&[Tag(474), Tag(475), Tag(482), Tag(486), Tag(509), Tag(511), Tag(522), Tag(539)],
&[NestedParties::TABLE],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(509), Tag(511), Tag(474), Tag(482), Tag(539), Tag(522), Tag(486), Tag(475)],
&[NestedParties::known_tags()],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "RegistDtls")]
pub fn regist_dtls(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(509))
}
#[doc(alias = "RegistEmail")]
pub fn regist_email(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(511))
}
#[doc(alias = "MailingDtls")]
pub fn mailing_dtls(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(474))
}
#[doc(alias = "MailingInst")]
pub fn mailing_inst(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(482))
}
#[doc(alias = "NoNestedPartyIDs")]
pub fn nested_party_ids(&self) -> Result<Instances<'a, NestedParties<'a>>, InvalidValue> {
self.0.get_group(&NestedParties::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "OwnerType")]
pub fn owner_type(&self) -> Result<Option<OwnerType>, InvalidValue> {
Ok(self.0.get_int(Tag(522))?.map(OwnerType::from_value))
}
#[doc(alias = "DateOfBirth")]
pub fn date_of_birth(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(486))
}
#[doc(alias = "InvestorCountryOfResidence")]
pub fn investor_country_of_residence(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(475))
}
}
impl std::fmt::Debug for RgstDtlsGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "RgstDtlsGrp({})", self.0)
}
}