refix_fix44/generated/messages/
registration_instructions.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
5
6use super::super::components::{Header, Parties, RgstDistInstGrp, RgstDtlsGrp, Trailer};
7use super::super::enums::{AcctIDSource, OwnershipType, RegistTransType, TaxAdvantageType};
8
9pub struct RegistrationInstructions(RawMessage);
11
12impl RegistrationInstructions {
13 pub const MSG_TYPE: &[u8] = b"o";
14
15 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
16 static TAGS: LazyKnownTags = LazyKnownTags::new(
17 &[
18 Tag(513), Tag(514), Tag(508), Tag(11), Tag(453), Tag(1), Tag(660), Tag(493),
19 Tag(495), Tag(517), Tag(473), Tag(510),
20 ],
21 &[
22 Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
23 RgstDtlsGrp::known_tags(), RgstDistInstGrp::known_tags(),
24 ],
25 );
26 &TAGS
27 }
28
29 pub fn from_raw(raw: RawMessage) -> Self {
30 Self(raw)
31 }
32
33 pub fn raw(&self) -> &RawMessage {
34 &self.0
35 }
36
37 pub fn header(&self) -> Header<'_> {
38 Header(self.0.scope(), Self::known_tags().get())
39 }
40
41 pub fn trailer(&self) -> Trailer<'_> {
42 Trailer(self.0.scope())
43 }
44
45 #[doc(alias = "RegistID")]
47 pub fn regist_id(&self) -> Result<Option<&str>, InvalidValue> {
48 self.0.get_str(Tag(513))
49 }
50
51 #[doc(alias = "RegistTransType")]
53 pub fn regist_trans_type(&self) -> Result<Option<RegistTransType<'_>>, InvalidValue> {
54 Ok(self.0.get_str(Tag(514))?.map(RegistTransType::from_value))
55 }
56
57 #[doc(alias = "RegistRefID")]
59 pub fn regist_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
60 self.0.get_str(Tag(508))
61 }
62
63 #[doc(alias = "ClOrdID")]
65 pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
66 self.0.get_str(Tag(11))
67 }
68
69 #[doc(alias = "NoPartyIDs")]
71 pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
72 self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
73 }
74
75 #[doc(alias = "Account")]
77 pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
78 self.0.get_str(Tag(1))
79 }
80
81 #[doc(alias = "AcctIDSource")]
83 pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
84 Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
85 }
86
87 #[doc(alias = "RegistAcctType")]
89 pub fn regist_acct_type(&self) -> Result<Option<&str>, InvalidValue> {
90 self.0.get_str(Tag(493))
91 }
92
93 #[doc(alias = "TaxAdvantageType")]
95 pub fn tax_advantage_type(&self) -> Result<Option<TaxAdvantageType>, InvalidValue> {
96 Ok(self.0.get_int(Tag(495))?.map(TaxAdvantageType::from_value))
97 }
98
99 #[doc(alias = "OwnershipType")]
101 pub fn ownership_type(&self) -> Result<Option<OwnershipType<'_>>, InvalidValue> {
102 Ok(self.0.get_str(Tag(517))?.map(OwnershipType::from_value))
103 }
104
105 #[doc(alias = "NoRegistDtls")]
107 pub fn regist_dtls(&self) -> Result<Instances<'_, RgstDtlsGrp<'_>>, InvalidValue> {
108 self.0.get_group(&RgstDtlsGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
109 }
110
111 #[doc(alias = "NoDistribInsts")]
113 pub fn distrib_insts(&self) -> Result<Instances<'_, RgstDistInstGrp<'_>>, InvalidValue> {
114 self.0.get_group(&RgstDistInstGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
115 }
116}
117
118impl std::fmt::Debug for RegistrationInstructions {
119 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
120 write!(f, "RegistrationInstructions({})", self.0)
121 }
122}
123
124impl std::fmt::Display for RegistrationInstructions {
125 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
126 std::fmt::Display::fmt(&self.0, f)
127 }
128}