refix-fix44 0.12.0

Typed FIX 4.4 protocol messages for the ReFIX engine
Documentation
// @generated by refix codegen from FIX44.xml. Do not edit.
#![cfg_attr(rustfmt, rustfmt::skip)]

use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};

use super::super::components::{Header, Instrument, Parties, Trailer, UnderlyingInstrument};
use super::super::enums::{AcctIDSource, MassStatusReqType, Side};

/// The `OrderMassStatusRequest` (35=AF) message.
pub struct OrderMassStatusRequest(RawMessage);

impl OrderMassStatusRequest {
    pub const MSG_TYPE: &[u8] = b"AF";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(584), Tag(585), Tag(453), Tag(1), Tag(660), Tag(336), Tag(625), Tag(54)],
            &[
                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
                Instrument::known_tags(), UnderlyingInstrument::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())
    }

    /// The `MassStatusReqID` (584) field.
    #[doc(alias = "MassStatusReqID")]
    pub fn mass_status_req_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(584))
    }

    /// The `MassStatusReqType` (585) field.
    #[doc(alias = "MassStatusReqType")]
    pub fn mass_status_req_type(&self) -> Result<Option<MassStatusReqType>, InvalidValue> {
        Ok(self.0.get_int(Tag(585))?.map(MassStatusReqType::from_value))
    }

    /// The instances of the `NoPartyIDs` (453) group.
    #[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)
    }

    /// The `Account` (1) field.
    #[doc(alias = "Account")]
    pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(1))
    }

    /// The `AcctIDSource` (660) field.
    #[doc(alias = "AcctIDSource")]
    pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
        Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
    }

    /// The `TradingSessionID` (336) field.
    #[doc(alias = "TradingSessionID")]
    pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(336))
    }

    /// The `TradingSessionSubID` (625) field.
    #[doc(alias = "TradingSessionSubID")]
    pub fn trading_session_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(625))
    }

    /// The `Instrument` component.
    pub fn instrument(&self) -> Instrument<'_> {
        Instrument(self.0.scope(), Self::known_tags().get())
    }

    /// The `UnderlyingInstrument` component.
    pub fn underlying_instrument(&self) -> UnderlyingInstrument<'_> {
        UnderlyingInstrument(self.0.scope(), Self::known_tags().get())
    }

    /// The `Side` (54) field.
    #[doc(alias = "Side")]
    pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
    }
}

impl std::fmt::Debug for OrderMassStatusRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "OrderMassStatusRequest({})", self.0)
    }
}

impl std::fmt::Display for OrderMassStatusRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(&self.0, f)
    }
}