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::{Date, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};

use super::super::components::{
    FinancingDetails, Header, InstrmtLegGrp, Instrument, InstrumentExtension, Parties, Trailer,
    TrdCapDtGrp, UndInstrmtGrp,
};
use super::super::enums::{
    ExecType, MatchStatus, MultiLegReportingType, ResponseTransportType, Side,
    SubscriptionRequestType, TradeRequestType, TrdType,
};

/// The `TradeCaptureReportRequest` (35=AD) message.
pub struct TradeCaptureReportRequest(RawMessage);

impl TradeCaptureReportRequest {
    pub const MSG_TYPE: &[u8] = b"AD";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(568), Tag(569), Tag(263), Tag(571), Tag(818), Tag(17), Tag(150), Tag(37),
                Tag(11), Tag(573), Tag(828), Tag(829), Tag(830), Tag(855), Tag(820), Tag(880),
                Tag(453), Tag(711), Tag(555), Tag(580), Tag(715), Tag(336), Tag(625), Tag(943),
                Tag(54), Tag(442), Tag(578), Tag(579), Tag(725), Tag(726), Tag(58), Tag(354),
                Tag(355),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
                Instrument::known_tags(), InstrumentExtension::known_tags(),
                FinancingDetails::known_tags(), UndInstrmtGrp::known_tags(),
                InstrmtLegGrp::known_tags(), TrdCapDtGrp::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 `TradeRequestID` (568) field.
    #[doc(alias = "TradeRequestID")]
    pub fn trade_request_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(568))
    }

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

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

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

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

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

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

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

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

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

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

    /// The `TrdSubType` (829) field.
    #[doc(alias = "TrdSubType")]
    pub fn trd_sub_type(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(829))
    }

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

    /// The `SecondaryTrdType` (855) field.
    #[doc(alias = "SecondaryTrdType")]
    pub fn secondary_trd_type(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(855))
    }

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

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

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

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

    /// The `FinancingDetails` component.
    pub fn financing_details(&self) -> FinancingDetails<'_> {
        FinancingDetails(self.0.scope())
    }

    /// The instances of the `NoUnderlyings` (711) group.
    #[doc(alias = "NoUnderlyings")]
    pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
        self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The instances of the `NoLegs` (555) group.
    #[doc(alias = "NoLegs")]
    pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
        self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The instances of the `NoDates` (580) group.
    #[doc(alias = "NoDates")]
    pub fn dates(&self) -> Result<Instances<'_, TrdCapDtGrp<'_>>, InvalidValue> {
        self.0.get_group(&TrdCapDtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The `ClearingBusinessDate` (715) field.
    #[doc(alias = "ClearingBusinessDate")]
    pub fn clearing_business_date(&self) -> Result<Option<Date>, InvalidValue> {
        self.0.get_date(Tag(715))
    }

    /// 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 `TimeBracket` (943) field.
    #[doc(alias = "TimeBracket")]
    pub fn time_bracket(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(943))
    }

    /// 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))
    }

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

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

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

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

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

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

    /// The `EncodedTextLen` (354) field.
    #[doc(alias = "EncodedTextLen")]
    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(354))
    }

    /// The `EncodedText` (355) field.
    #[doc(alias = "EncodedText")]
    pub fn encoded_text(&self) -> Option<&[u8]> {
        self.0.get(Tag(355))
    }
}

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

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