#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
use super::super::components::{Header, Parties, Trailer};
use super::super::enums::{AcctIDSource, RegistRejReasonCode, RegistStatus, RegistTransType};
pub struct RegistrationInstructionsResponse(RawMessage);
impl RegistrationInstructionsResponse {
pub const MSG_TYPE: &[u8] = b"p";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(513), Tag(514), Tag(508), Tag(11), Tag(453), Tag(1), Tag(660), Tag(506),
Tag(507), Tag(496),
],
&[Header::known_tags(), Trailer::known_tags(), Parties::known_tags()],
);
&TAGS
}
pub fn from_raw(raw: RawMessage) -> Self {
Self(raw)
}
pub fn raw(&self) -> &RawMessage {
&self.0
}
pub fn header(&self) -> Header<'_> {
Header(self.0.scope(), Self::known_tags().get())
}
pub fn trailer(&self) -> Trailer<'_> {
Trailer(self.0.scope())
}
#[doc(alias = "RegistID")]
pub fn regist_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(513))
}
#[doc(alias = "RegistTransType")]
pub fn regist_trans_type(&self) -> Result<Option<RegistTransType<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(514))?.map(RegistTransType::from_value))
}
#[doc(alias = "RegistRefID")]
pub fn regist_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(508))
}
#[doc(alias = "ClOrdID")]
pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(11))
}
#[doc(alias = "NoPartyIDs")]
pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "Account")]
pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(1))
}
#[doc(alias = "AcctIDSource")]
pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
}
#[doc(alias = "RegistStatus")]
pub fn regist_status(&self) -> Result<Option<RegistStatus<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(506))?.map(RegistStatus::from_value))
}
#[doc(alias = "RegistRejReasonCode")]
pub fn regist_rej_reason_code(&self) -> Result<Option<RegistRejReasonCode>, InvalidValue> {
Ok(self.0.get_int(Tag(507))?.map(RegistRejReasonCode::from_value))
}
#[doc(alias = "RegistRejReasonText")]
pub fn regist_rej_reason_text(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(496))
}
}
impl std::fmt::Debug for RegistrationInstructionsResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "RegistrationInstructionsResponse({})", self.0)
}
}
impl std::fmt::Display for RegistrationInstructionsResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}