#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Decimal, GroupTable, InvalidValue, LazyKnownTags, Tag};
use super::super::enums::DistribPaymentMethod;
#[derive(Clone, Copy)]
pub struct RgstDistInstGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for RgstDistInstGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> RgstDistInstGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(510),
Tag(477),
&[Tag(477), Tag(478), Tag(498), Tag(499), Tag(500), Tag(501), Tag(502), Tag(512)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(477), Tag(512), Tag(478), Tag(498), Tag(499), Tag(500), Tag(501), Tag(502)],
&[],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "DistribPaymentMethod")]
pub fn distrib_payment_method(&self) -> Result<Option<DistribPaymentMethod>, InvalidValue> {
Ok(self.0.get_int(Tag(477))?.map(DistribPaymentMethod::from_value))
}
#[doc(alias = "DistribPercentage")]
pub fn distrib_percentage(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(512))
}
#[doc(alias = "CashDistribCurr")]
pub fn cash_distrib_curr(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(478))
}
#[doc(alias = "CashDistribAgentName")]
pub fn cash_distrib_agent_name(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(498))
}
#[doc(alias = "CashDistribAgentCode")]
pub fn cash_distrib_agent_code(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(499))
}
#[doc(alias = "CashDistribAgentAcctNumber")]
pub fn cash_distrib_agent_acct_number(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(500))
}
#[doc(alias = "CashDistribPayRef")]
pub fn cash_distrib_pay_ref(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(501))
}
#[doc(alias = "CashDistribAgentAcctName")]
pub fn cash_distrib_agent_acct_name(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(502))
}
}
impl std::fmt::Debug for RgstDistInstGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "RgstDistInstGrp({})", self.0)
}
}