#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
use super::super::components::{Header, InstrmtLegGrp, Instrument, Parties, Trailer, UndInstrmtGrp};
use super::super::enums::{
AccountType, AcctIDSource, PosReqResult, PosReqStatus, ResponseTransportType,
};
pub struct RequestForPositionsAck(RawMessage);
impl RequestForPositionsAck {
pub const MSG_TYPE: &[u8] = b"AO";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(721), Tag(710), Tag(727), Tag(325), Tag(728), Tag(729), Tag(453), Tag(1),
Tag(660), Tag(581), Tag(15), Tag(555), Tag(711), Tag(725), Tag(726), Tag(58),
Tag(354), Tag(355),
],
&[
Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
Instrument::known_tags(), InstrmtLegGrp::known_tags(), UndInstrmtGrp::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 = "PosMaintRptID")]
pub fn pos_maint_rpt_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(721))
}
#[doc(alias = "PosReqID")]
pub fn pos_req_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(710))
}
#[doc(alias = "TotalNumPosReports")]
pub fn total_num_pos_reports(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(727))
}
#[doc(alias = "UnsolicitedIndicator")]
pub fn unsolicited_indicator(&self) -> Result<Option<bool>, InvalidValue> {
self.0.get_bool(Tag(325))
}
#[doc(alias = "PosReqResult")]
pub fn pos_req_result(&self) -> Result<Option<PosReqResult>, InvalidValue> {
Ok(self.0.get_int(Tag(728))?.map(PosReqResult::from_value))
}
#[doc(alias = "PosReqStatus")]
pub fn pos_req_status(&self) -> Result<Option<PosReqStatus>, InvalidValue> {
Ok(self.0.get_int(Tag(729))?.map(PosReqStatus::from_value))
}
#[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 = "AccountType")]
pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
}
pub fn instrument(&self) -> Instrument<'_> {
Instrument(self.0.scope(), Self::known_tags().get())
}
#[doc(alias = "Currency")]
pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(15))
}
#[doc(alias = "NoLegs")]
pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoUnderlyings")]
pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "ResponseTransportType")]
pub fn response_transport_type(&self) -> Result<Option<ResponseTransportType>, InvalidValue> {
Ok(self.0.get_int(Tag(725))?.map(ResponseTransportType::from_value))
}
#[doc(alias = "ResponseDestination")]
pub fn response_destination(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(726))
}
#[doc(alias = "Text")]
pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(58))
}
#[doc(alias = "EncodedTextLen")]
pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(354))
}
#[doc(alias = "EncodedText")]
pub fn encoded_text(&self) -> Option<&[u8]> {
self.0.get(Tag(355))
}
}
impl std::fmt::Debug for RequestForPositionsAck {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "RequestForPositionsAck({})", self.0)
}
}
impl std::fmt::Display for RequestForPositionsAck {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}