#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Date, Decimal, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
use super::super::components::{
Header, InstrmtLegGrp, Instrument, Parties, PositionAmountData, PositionQty, Trailer,
UndInstrmtGrp,
};
use super::super::enums::{
AccountType, AssignmentMethod, ExerciseMethod, SettlPriceType, SettlSessID,
};
pub struct AssignmentReport(RawMessage);
impl AssignmentReport {
pub const MSG_TYPE: &[u8] = b"AW";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(833), Tag(832), Tag(912), Tag(453), Tag(1), Tag(581), Tag(15), Tag(555),
Tag(711), Tag(702), Tag(753), Tag(834), Tag(730), Tag(731), Tag(732), Tag(432),
Tag(744), Tag(745), Tag(746), Tag(747), Tag(716), Tag(717), Tag(715), Tag(58),
Tag(354), Tag(355),
],
&[
Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
Instrument::known_tags(), InstrmtLegGrp::known_tags(), UndInstrmtGrp::known_tags(),
PositionQty::known_tags(), PositionAmountData::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())
}
#[doc(alias = "AsgnRptID")]
pub fn asgn_rpt_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(833))
}
#[doc(alias = "TotNumAssignmentReports")]
pub fn tot_num_assignment_reports(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(832))
}
#[doc(alias = "LastRptRequested")]
pub fn last_rpt_requested(&self) -> Result<Option<bool>, InvalidValue> {
self.0.get_bool(Tag(912))
}
#[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)
}
#[doc(alias = "Account")]
pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(1))
}
#[doc(alias = "AccountType")]
pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
}
pub fn instrument(&self) -> Instrument<'_> {
Instrument(self.0.scope(), Self::known_tags().get())
}
#[doc(alias = "Currency")]
pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(15))
}
#[doc(alias = "NoLegs")]
pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoUnderlyings")]
pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoPositions")]
pub fn positions(&self) -> Result<Instances<'_, PositionQty<'_>>, InvalidValue> {
self.0.get_group(&PositionQty::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoPosAmt")]
pub fn pos_amt(&self) -> Result<Instances<'_, PositionAmountData<'_>>, InvalidValue> {
self.0.get_group(&PositionAmountData::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "ThresholdAmount")]
pub fn threshold_amount(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(834))
}
#[doc(alias = "SettlPrice")]
pub fn settl_price(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(730))
}
#[doc(alias = "SettlPriceType")]
pub fn settl_price_type(&self) -> Result<Option<SettlPriceType>, InvalidValue> {
Ok(self.0.get_int(Tag(731))?.map(SettlPriceType::from_value))
}
#[doc(alias = "UnderlyingSettlPrice")]
pub fn underlying_settl_price(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(732))
}
#[doc(alias = "ExpireDate")]
pub fn expire_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(432))
}
#[doc(alias = "AssignmentMethod")]
pub fn assignment_method(&self) -> Result<Option<AssignmentMethod<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(744))?.map(AssignmentMethod::from_value))
}
#[doc(alias = "AssignmentUnit")]
pub fn assignment_unit(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(745))
}
#[doc(alias = "OpenInterest")]
pub fn open_interest(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(746))
}
#[doc(alias = "ExerciseMethod")]
pub fn exercise_method(&self) -> Result<Option<ExerciseMethod<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(747))?.map(ExerciseMethod::from_value))
}
#[doc(alias = "SettlSessID")]
pub fn settl_sess_id(&self) -> Result<Option<SettlSessID<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(716))?.map(SettlSessID::from_value))
}
#[doc(alias = "SettlSessSubID")]
pub fn settl_sess_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(717))
}
#[doc(alias = "ClearingBusinessDate")]
pub fn clearing_business_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(715))
}
#[doc(alias = "Text")]
pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(58))
}
#[doc(alias = "EncodedTextLen")]
pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(354))
}
#[doc(alias = "EncodedText")]
pub fn encoded_text(&self) -> Option<&[u8]> {
self.0.get(Tag(355))
}
}
impl std::fmt::Debug for AssignmentReport {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "AssignmentReport({})", self.0)
}
}
impl std::fmt::Display for AssignmentReport {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}