Skip to main content

osdm_sys/models/
admission.rs

1/*
2 * UIC 90918-10 - OSDM
3 *
4 * Specifications for the OSDM API standard. The OSDM specification supports two modes of operation: Retailer Mode and Distributor Mode. The API works identically in both modes, except that in distributor mode the API also returns fare information.  The following resources are key to get started:    -  [Processes](https://osdm.io/spec/processes/)   -  [Models](https://osdm.io/spec/models/)   -  [Getting started](https://osdm.io/spec/getting-started/) 
5 *
6 * The version of the OpenAPI document: 3.7.0
7 * Contact: osdm@uic.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Admission : An admission represents a travel right, or the entitlement to travel onboard a train between the given origin and destination, following the given route. It does not include a seat reservation. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
17pub struct Admission {
18    /// Attribute is used as discriminator for inheritance between data types.
19    #[serde(rename = "objectType")]
20    pub object_type: String,
21    #[serde(rename = "id")]
22    pub id: String,
23    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub summary: Option<Option<String>>,
25    /// Validity of offer towards passenger 
26    #[serde(rename = "createdOn")]
27    pub created_on: String,
28    /// confirmationTimeLimit in booking should be used. Date until the booking part needs to be confirmed. Must be provided for a booking part in PREBOOKED stated. For later states, the value is ignored and can be null. 
29    #[serde(rename = "confirmableUntil", skip_serializing_if = "Option::is_none")]
30    pub confirmable_until: Option<String>,
31    #[serde(rename = "validFrom")]
32    pub valid_from: String,
33    /// Validity of offer towards passenger 
34    #[serde(rename = "validUntil", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub valid_until: Option<Option<String>>,
36    #[serde(rename = "confirmedOn", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37    pub confirmed_on: Option<Option<String>>,
38    #[serde(rename = "confirmedFulfillmentOptions", skip_serializing_if = "Option::is_none")]
39    pub confirmed_fulfillment_options: Option<Box<models::FulfillmentOption>>,
40    #[serde(rename = "price")]
41    pub price: Box<models::Price>,
42    #[serde(rename = "refundAmount", skip_serializing_if = "Option::is_none")]
43    pub refund_amount: Option<Box<models::Price>>,
44    #[serde(rename = "tripCoverage", skip_serializing_if = "Option::is_none")]
45    pub trip_coverage: Option<Box<models::TripCoverage>>,
46    #[serde(rename = "inboundTripCoverage", skip_serializing_if = "Option::is_none")]
47    pub inbound_trip_coverage: Option<Box<models::TripCoverage>>,
48    /// Id of the product representing the commercial attributes of this booking part. Although not currently mandatory, this attribute should in all cases be filled in order to allow matching a booking response to the data in the booking request 
49    #[serde(rename = "summaryProductId", skip_serializing_if = "Option::is_none")]
50    pub summary_product_id: Option<String>,
51    /// In offer mode, in almost all cases exactly one product is referenced. Only on some French trips consisting of a TGV and a TER two products need to be used. In fare mode, no product exists as first needs to created from the different fares. 
52    #[serde(rename = "products", skip_serializing_if = "Option::is_none")]
53    pub products: Option<Vec<models::ProductLegAssociation>>,
54    #[serde(rename = "status")]
55    pub status: models::BookingPartStatus,
56    /// payment status in post-payment scenarios
57    #[serde(rename = "pricingStatus", skip_serializing_if = "Option::is_none")]
58    pub pricing_status: Option<String>,
59    #[serde(rename = "offerMode", skip_serializing_if = "Option::is_none")]
60    pub offer_mode: Option<models::OfferMode>,
61    /// The unique booking code for the part in the provider system. 
62    #[serde(rename = "bookingPartCode", skip_serializing_if = "Option::is_none")]
63    pub booking_part_code: Option<String>,
64    /// reference to the booking in the downstream distributor system 
65    #[serde(rename = "distributorBookingRef", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
66    pub distributor_booking_ref: Option<Option<String>>,
67    /// reference to the booking in the downstream distributor system 
68    #[serde(rename = "retailerBookingRef", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
69    pub retailer_booking_ref: Option<Option<String>>,
70    /// Id of the passenger 
71    #[serde(rename = "passengerIds")]
72    pub passenger_ids: Vec<String>,
73    #[serde(rename = "availableFulfillmentOptions", skip_serializing_if = "Option::is_none")]
74    pub available_fulfillment_options: Option<Vec<models::FulfillmentOption>>,
75    #[serde(rename = "refundable")]
76    pub refundable: models::RefundType,
77    #[serde(rename = "exchangeable")]
78    pub exchangeable: models::ExchangeableType,
79    /// Fine grained specification of the after sale condition of the booking. 
80    #[serde(rename = "afterSaleConditions", skip_serializing_if = "Option::is_none")]
81    pub after_sale_conditions: Option<Vec<models::AfterSaleCondition>>,
82    #[serde(rename = "afterSalesOverrideDetails", skip_serializing_if = "Option::is_none")]
83    pub after_sales_override_details: Option<Box<models::AfterSalesOverrideDetails>>,
84    #[serde(rename = "appliedCorporateCodes", skip_serializing_if = "Option::is_none")]
85    pub applied_corporate_codes: Option<Vec<models::CorporateCode>>,
86    #[serde(rename = "appliedPassengerTypes", skip_serializing_if = "Option::is_none")]
87    pub applied_passenger_types: Option<Vec<models::AppliedPassengerType>>,
88    #[serde(rename = "appliedPromotionCodes", skip_serializing_if = "Option::is_none")]
89    pub applied_promotion_codes: Option<Vec<models::PromotionCode>>,
90    #[serde(rename = "appliedReductions", skip_serializing_if = "Option::is_none")]
91    pub applied_reductions: Option<Vec<models::CardReference>>,
92    #[serde(rename = "indicatedConsumption", skip_serializing_if = "Option::is_none")]
93    pub indicated_consumption: Option<Box<models::IndicatedConsumption>>,
94    #[serde(rename = "accountingRef", skip_serializing_if = "Option::is_none")]
95    pub accounting_ref: Option<Box<models::AccountingRef>>,
96    #[serde(rename = "grantedReductionAmounts", skip_serializing_if = "Option::is_none")]
97    pub granted_reduction_amounts: Option<Box<models::GrantedReductionAmounts>>,
98    #[serde(rename = "regionalValidity", skip_serializing_if = "Option::is_none")]
99    pub regional_validity: Option<Box<models::RegionalValidity>>,
100    /// This contains multiple regional validities for this item and replaces the `regionalValidity` (deprecated) attribute.
101    #[serde(rename = "regionalValidities", skip_serializing_if = "Option::is_none")]
102    pub regional_validities: Option<Vec<models::RegionalValidity>>,
103    #[serde(rename = "isReservationRequired", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
104    pub is_reservation_required: Option<Option<bool>>,
105    #[serde(rename = "feeRefs", skip_serializing_if = "Option::is_none")]
106    pub fee_refs: Option<Vec<models::BookingPartReference>>,
107    #[serde(rename = "reservationRefs", skip_serializing_if = "Option::is_none")]
108    pub reservation_refs: Option<Vec<models::BookingPartReference>>,
109    #[serde(rename = "ancillaryRefs", skip_serializing_if = "Option::is_none")]
110    pub ancillary_refs: Option<Vec<models::BookingPartReference>>,
111    #[serde(rename = "regulatoryConditions", skip_serializing_if = "Option::is_none")]
112    pub regulatory_conditions: Option<Vec<models::RegulatoryCondition>>,
113}
114
115impl Admission {
116    /// An admission represents a travel right, or the entitlement to travel onboard a train between the given origin and destination, following the given route. It does not include a seat reservation. 
117    pub fn new(object_type: String, id: String, created_on: String, valid_from: String, price: models::Price, status: models::BookingPartStatus, passenger_ids: Vec<String>, refundable: models::RefundType, exchangeable: models::ExchangeableType) -> Admission {
118        Admission {
119            object_type,
120            id,
121            summary: None,
122            created_on,
123            confirmable_until: None,
124            valid_from,
125            valid_until: None,
126            confirmed_on: None,
127            confirmed_fulfillment_options: None,
128            price: Box::new(price),
129            refund_amount: None,
130            trip_coverage: None,
131            inbound_trip_coverage: None,
132            summary_product_id: None,
133            products: None,
134            status,
135            pricing_status: None,
136            offer_mode: None,
137            booking_part_code: None,
138            distributor_booking_ref: None,
139            retailer_booking_ref: None,
140            passenger_ids,
141            available_fulfillment_options: None,
142            refundable,
143            exchangeable,
144            after_sale_conditions: None,
145            after_sales_override_details: None,
146            applied_corporate_codes: None,
147            applied_passenger_types: None,
148            applied_promotion_codes: None,
149            applied_reductions: None,
150            indicated_consumption: None,
151            accounting_ref: None,
152            granted_reduction_amounts: None,
153            regional_validity: None,
154            regional_validities: None,
155            is_reservation_required: None,
156            fee_refs: None,
157            reservation_refs: None,
158            ancillary_refs: None,
159            regulatory_conditions: None,
160        }
161    }
162}
163