#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
use super::super::components::{
FinancingDetails, Header, InstrmtLegGrp, Instrument, Parties, Trailer, UndInstrmtGrp,
};
use super::super::enums::{AccountType, AcctIDSource, SubscriptionRequestType};
pub struct QuoteStatusRequest(RawMessage);
impl QuoteStatusRequest {
pub const MSG_TYPE: &[u8] = b"a";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(649), Tag(117), Tag(711), Tag(555), Tag(453), Tag(1), Tag(660), Tag(581),
Tag(336), Tag(625), Tag(263),
],
&[
Header::known_tags(), Trailer::known_tags(), Instrument::known_tags(),
FinancingDetails::known_tags(), UndInstrmtGrp::known_tags(),
InstrmtLegGrp::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 = "QuoteStatusReqID")]
pub fn quote_status_req_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(649))
}
#[doc(alias = "QuoteID")]
pub fn quote_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(117))
}
pub fn instrument(&self) -> Instrument<'_> {
Instrument(self.0.scope(), Self::known_tags().get())
}
pub fn financing_details(&self) -> FinancingDetails<'_> {
FinancingDetails(self.0.scope())
}
#[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 = "NoLegs")]
pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[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))
}
#[doc(alias = "TradingSessionID")]
pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(336))
}
#[doc(alias = "TradingSessionSubID")]
pub fn trading_session_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(625))
}
#[doc(alias = "SubscriptionRequestType")]
pub fn subscription_request_type(&self) -> Result<Option<SubscriptionRequestType<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(263))?.map(SubscriptionRequestType::from_value))
}
}
impl std::fmt::Debug for QuoteStatusRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "QuoteStatusRequest({})", self.0)
}
}
impl std::fmt::Display for QuoteStatusRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}