#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, Tag};
use super::NestedParties2;
#[derive(Clone, Copy)]
pub struct OrdAllocGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for OrdAllocGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> OrdAllocGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(73),
Tag(11),
&[Tag(11), Tag(37), Tag(38), Tag(66), Tag(198), Tag(526), Tag(756), Tag(799), Tag(800)],
&[NestedParties2::TABLE],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(11), Tag(37), Tag(198), Tag(526), Tag(66), Tag(756), Tag(38), Tag(799), Tag(800)],
&[NestedParties2::known_tags()],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "ClOrdID")]
pub fn cl_ord_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(11))
}
#[doc(alias = "OrderID")]
pub fn order_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(37))
}
#[doc(alias = "SecondaryOrderID")]
pub fn secondary_order_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(198))
}
#[doc(alias = "SecondaryClOrdID")]
pub fn secondary_cl_ord_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(526))
}
#[doc(alias = "ListID")]
pub fn list_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(66))
}
#[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 = "OrderQty")]
pub fn order_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(38))
}
#[doc(alias = "OrderAvgPx")]
pub fn order_avg_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(799))
}
#[doc(alias = "OrderBookingQty")]
pub fn order_booking_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(800))
}
}
impl std::fmt::Debug for OrdAllocGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "OrdAllocGrp({})", self.0)
}
}