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

use super::super::components::{
    ExecCollGrp, FinancingDetails, Header, InstrmtLegGrp, Instrument, MiscFeesGrp, Parties,
    SpreadOrBenchmarkCurveData, Stipulations, Trailer, TrdCollGrp, TrdRegTimestamps,
    UndInstrmtCollGrp,
};
use super::super::enums::{
    AccountType, CollAsgnReason, CollAsgnRejectReason, CollAsgnRespType, CollAsgnTransType,
    PriceType, QtyType, Side,
};

/// The `CollateralResponse` (35=AZ) message.
pub struct CollateralResponse(RawMessage);

impl CollateralResponse {
    pub const MSG_TYPE: &[u8] = b"AZ";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(904), Tag(902), Tag(894), Tag(895), Tag(903), Tag(905), Tag(906), Tag(60),
                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(899),
                Tag(900), Tag(901), Tag(768), Tag(54), Tag(136), Tag(44), Tag(423), Tag(159),
                Tag(920), Tag(921), Tag(922), Tag(232), Tag(58), Tag(354), Tag(355),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
                ExecCollGrp::known_tags(), TrdCollGrp::known_tags(), Instrument::known_tags(),
                FinancingDetails::known_tags(), InstrmtLegGrp::known_tags(),
                UndInstrmtCollGrp::known_tags(), TrdRegTimestamps::known_tags(),
                MiscFeesGrp::known_tags(), SpreadOrBenchmarkCurveData::known_tags(),
                Stipulations::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 `CollRespID` (904) field.
    #[doc(alias = "CollRespID")]
    pub fn coll_resp_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(904))
    }

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

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

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

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

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

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

    /// 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 `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<'_, UndInstrmtCollGrp<'_>>, InvalidValue> {
        self.0.get_group(&UndInstrmtCollGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

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

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

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

    /// 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 `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 instances of the `NoMiscFees` (136) group.
    #[doc(alias = "NoMiscFees")]
    pub fn misc_fees(&self) -> Result<Instances<'_, MiscFeesGrp<'_>>, InvalidValue> {
        self.0.get_group(&MiscFeesGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

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

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

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

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

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

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

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

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

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

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