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, MultipleValues, RawMessage, Tag, UtcTimestamp,
};

use super::super::components::{
    Header, Instrument, Trailer, TrdAllocGrp, TrdInstrmtLegGrp, TrdRegTimestamps,
};
use super::super::enums::{
    AccountType, AcctIDSource, ClearingFeeIndicator, CustOrderCapacity, ExecType, OrderCapacity,
    OrderRestrictions, PositionEffect, PreallocMethod, ResponseTransportType,
    SubscriptionRequestType, TradeReportRejectReason, TradeReportType, TrdRptStatus, TrdType,
};

/// The `TradeCaptureReportAck` (35=AR) message.
pub struct TradeCaptureReportAck(RawMessage);

impl TradeCaptureReportAck {
    pub const MSG_TYPE: &[u8] = b"AR";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(571), Tag(487), Tag(856), Tag(828), Tag(829), Tag(855), Tag(830), Tag(150),
                Tag(572), Tag(881), Tag(939), Tag(751), Tag(818), Tag(263), Tag(820), Tag(880),
                Tag(17), Tag(527), Tag(60), Tag(768), Tag(725), Tag(726), Tag(58), Tag(354),
                Tag(355), Tag(555), Tag(635), Tag(528), Tag(529), Tag(582), Tag(1), Tag(660),
                Tag(581), Tag(77), Tag(591), Tag(78),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), Instrument::known_tags(),
                TrdRegTimestamps::known_tags(), TrdInstrmtLegGrp::known_tags(),
                TrdAllocGrp::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 `TradeReportID` (571) field.
    #[doc(alias = "TradeReportID")]
    pub fn trade_report_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(571))
    }

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

    /// The `TradeReportType` (856) field.
    #[doc(alias = "TradeReportType")]
    pub fn trade_report_type(&self) -> Result<Option<TradeReportType>, InvalidValue> {
        Ok(self.0.get_int(Tag(856))?.map(TradeReportType::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 `SecondaryTrdType` (855) field.
    #[doc(alias = "SecondaryTrdType")]
    pub fn secondary_trd_type(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(855))
    }

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

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

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

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

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

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

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

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

    /// The `TransactTime` (60) field.
    #[doc(alias = "TransactTime")]
    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
        self.0.get_utc_timestamp(Tag(60))
    }

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

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

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

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

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

    /// The `OrderRestrictions` (529) field.
    #[doc(alias = "OrderRestrictions")]
    pub fn order_restrictions(&self) -> Result<Option<MultipleValues<'_, OrderRestrictions<'_>>>, InvalidValue> {
        self.0.get_multiple_values(Tag(529))
    }

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

    /// 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 `AccountType` (581) field.
    #[doc(alias = "AccountType")]
    pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
        Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
    }

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

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

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

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

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