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

use super::super::components::{
    CollInqQualGrp, ExecCollGrp, FinancingDetails, Header, InstrmtLegGrp, Instrument, Parties,
    Trailer, TrdCollGrp, UndInstrmtGrp,
};
use super::super::enums::{
    AccountType, CollInquiryResult, CollInquiryStatus, QtyType, ResponseTransportType, SettlSessID,
};

/// The `CollateralInquiryAck` (35=BG) message.
pub struct CollateralInquiryAck(RawMessage);

impl CollateralInquiryAck {
    pub const MSG_TYPE: &[u8] = b"BG";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(909), Tag(945), Tag(946), Tag(938), Tag(911), Tag(453), Tag(1), Tag(581),
                Tag(11), Tag(37), Tag(198), Tag(526), Tag(124), Tag(897), Tag(64), Tag(53),
                Tag(854), Tag(15), Tag(555), Tag(711), Tag(336), Tag(625), Tag(716), Tag(717),
                Tag(715), Tag(725), Tag(726), Tag(58), Tag(354), Tag(355),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), CollInqQualGrp::known_tags(),
                Parties::known_tags(), ExecCollGrp::known_tags(), TrdCollGrp::known_tags(),
                Instrument::known_tags(), FinancingDetails::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())
    }

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

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

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

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

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

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

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

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

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

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

    /// The instances of the `NoTrades` (897) group.
    #[doc(alias = "NoTrades")]
    pub fn trades(&self) -> Result<Instances<'_, TrdCollGrp<'_>>, InvalidValue> {
        self.0.get_group(&TrdCollGrp::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 `FinancingDetails` component.
    pub fn financing_details(&self) -> FinancingDetails<'_> {
        FinancingDetails(self.0.scope())
    }

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

    /// The `Quantity` (53) field.
    #[doc(alias = "Quantity")]
    pub fn quantity(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(53))
    }

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

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

    /// 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 `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 `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 `SettlSessID` (716) field.
    #[doc(alias = "SettlSessID")]
    pub fn settl_sess_id(&self) -> Result<Option<SettlSessID<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(716))?.map(SettlSessID::from_value))
    }

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

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

    /// 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 CollateralInquiryAck {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "CollateralInquiryAck({})", self.0)
    }
}

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