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

use super::super::enums::{
    AllocHandlInst, AllocSettlInstType, MatchStatus, ProcessCode, SettlCurrFxRateCalc,
};
use super::{
    ClrInstGrp, CommissionData, DlvyInstGrp, MiscFeesGrp, NestedParties, SettlInstructionsData,
};

/// An instance of the `NoAllocs` (78) group.
#[derive(Clone, Copy)]
pub struct AllocGrp<'a>(refix_message::Scope<'a>);

impl<'a> From<refix_message::Scope<'a>> for AllocGrp<'a> {
    fn from(scope: refix_message::Scope<'a>) -> Self {
        Self(scope)
    }
}

impl<'a> AllocGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(78),
        Tag(79),
        &[
            Tag(12), Tag(13), Tag(79), Tag(80), Tag(81), Tag(85), Tag(119), Tag(120), Tag(136),
            Tag(153), Tag(154), Tag(155), Tag(156), Tag(161), Tag(169), Tag(170), Tag(171),
            Tag(172), Tag(208), Tag(209), Tag(360), Tag(361), Tag(366), Tag(467), Tag(479),
            Tag(497), Tag(539), Tag(573), Tag(576), Tag(661), Tag(736), Tag(737), Tag(741),
            Tag(742), Tag(780),
        ],
        &[NestedParties::TABLE, MiscFeesGrp::TABLE, ClrInstGrp::TABLE, DlvyInstGrp::TABLE],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(79), Tag(661), Tag(573), Tag(366), Tag(80), Tag(467), Tag(81), Tag(539),
                Tag(208), Tag(209), Tag(161), Tag(360), Tag(361), Tag(153), Tag(154), Tag(119),
                Tag(737), Tag(120), Tag(736), Tag(155), Tag(156), Tag(742), Tag(741), Tag(136),
                Tag(576), Tag(780),
            ],
            &[
                NestedParties::known_tags(), CommissionData::known_tags(),
                MiscFeesGrp::known_tags(), ClrInstGrp::known_tags(),
                SettlInstructionsData::known_tags(),
            ],
        );
        &TAGS
    }

    pub fn raw(&self) -> refix_message::Scope<'a> {
        self.0
    }

    /// The `AllocAccount` (79) field.
    #[doc(alias = "AllocAccount")]
    pub fn alloc_account(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(79))
    }

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

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

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

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

    /// The `IndividualAllocID` (467) field.
    #[doc(alias = "IndividualAllocID")]
    pub fn individual_alloc_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(467))
    }

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

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

    /// The `NotifyBrokerOfCredit` (208) field.
    #[doc(alias = "NotifyBrokerOfCredit")]
    pub fn notify_broker_of_credit(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(208))
    }

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

    /// The `AllocText` (161) field.
    #[doc(alias = "AllocText")]
    pub fn alloc_text(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(161))
    }

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

    /// The `EncodedAllocText` (361) field.
    #[doc(alias = "EncodedAllocText")]
    pub fn encoded_alloc_text(&self) -> Option<&'a [u8]> {
        self.0.get(Tag(361))
    }

    /// The `CommissionData` component.
    pub fn commission_data(&self) -> CommissionData<'a> {
        CommissionData(self.0)
    }

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

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

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

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

    /// The `SettlCurrency` (120) field.
    #[doc(alias = "SettlCurrency")]
    pub fn settl_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(120))
    }

    /// The `AllocSettlCurrency` (736) field.
    #[doc(alias = "AllocSettlCurrency")]
    pub fn alloc_settl_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(736))
    }

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

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

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

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

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

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

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

    /// The `SettlInstructionsData` component.
    pub fn settl_instructions_data(&self) -> SettlInstructionsData<'a> {
        SettlInstructionsData(self.0, Self::known_tags().get())
    }
}

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