osdm_sys/models/
exchange_offer.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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ExchangeOffer {
16    #[serde(rename = "exchangeFee")]
17    pub exchange_fee: Box<models::Price>,
18    #[serde(rename = "accountingRef", skip_serializing_if = "Option::is_none")]
19    pub accounting_ref: Option<Box<models::AccountingRef>>,
20    #[serde(rename = "exchangePrice")]
21    pub exchange_price: Box<models::Price>,
22    #[serde(rename = "refundableAmount", skip_serializing_if = "Option::is_none")]
23    pub refundable_amount: Option<Box<models::Price>>,
24    #[serde(rename = "amountToBePaid", skip_serializing_if = "Option::is_none")]
25    pub amount_to_be_paid: Option<Box<models::Price>>,
26    /// Reason for and type of an after sale, code list in IRS 90918-10. The PRM_SUPPORT_UNAVAILABLE overrule code shall only be used by the UIC PRM ABT tool. Values from the [Overrule Codes Code List](https://osdm.io/spec/catalog-of-code-lists/#OverruleCode) Listed values here are examples.    - 'CONNECTION_BROKEN' - 'DEATH' - 'EQUIPMENT_FAILURE' - 'PAYMENT_FAILURE' - 'PRM_SUPPORT_UNAVAILABLE' - 'SALES_STAFF_ERROR' - 'STOP_NOT_SERVED' - 'STRIKE' - 'TECHNICAL_FAILURE' - 'TICKET_NOT_USED' - 'INABILITY_TO_TRAVEL': Inability to travel due to accident or sickness. - 'EXTERNAL_COMPENSATION': Offer has been compensated outside of the provider system in another way. - 'DISRUPTION': Inability to operate due to disruption. - 'JOURNEY_OBSOLETE': Due to external factors it's senseless to start the trip, thus the travel is obsolete. - 'CERTIFIED_MEDICAL_CONDITION': A medical certificate certifies that the passenger is unable to travel. - 'DELAY_COMPENSATION': Allows to override conditions in context of passenger rights regulation (PRR). 
27    #[serde(rename = "appliedOverruleCode", skip_serializing_if = "Option::is_none")]
28    pub applied_overrule_code: Option<String>,
29    #[serde(rename = "fulfillments")]
30    pub fulfillments: Vec<models::Fulfillment>,
31    #[serde(rename = "offerId")]
32    pub offer_id: String,
33    /// A human-readable description of the offer. 
34    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub summary: Option<Option<String>>,
36    #[serde(rename = "offerSummary", skip_serializing_if = "Option::is_none")]
37    pub offer_summary: Option<Box<models::OfferSummary>>,
38    #[serde(rename = "createdOn")]
39    pub created_on: String,
40    /// time until the offer can be pre-booked, however its availability is not guaranteed 
41    #[serde(rename = "preBookableUntil")]
42    pub pre_bookable_until: String,
43    #[serde(rename = "passengerRefs")]
44    pub passenger_refs: Vec<String>,
45    #[serde(rename = "products", skip_serializing_if = "Option::is_none")]
46    pub products: Option<Vec<models::Product>>,
47    #[serde(rename = "tripCoverage", skip_serializing_if = "Option::is_none")]
48    pub trip_coverage: Option<Box<models::TripCoverage>>,
49    #[serde(rename = "inboundTripCoverage", skip_serializing_if = "Option::is_none")]
50    pub inbound_trip_coverage: Option<Box<models::TripCoverage>>,
51    /// Breakdown of the exchange offer, including the exchange price, exchange fee, and refundable amount. 
52    #[serde(rename = "exchangeOfferBreakdown", skip_serializing_if = "Option::is_none")]
53    pub exchange_offer_breakdown: Option<Vec<models::ExchangeBreakdownItem>>,
54    #[serde(rename = "admissionOfferParts")]
55    pub admission_offer_parts: Vec<models::AdmissionOfferPart>,
56    #[serde(rename = "reservationOfferParts", skip_serializing_if = "Option::is_none")]
57    pub reservation_offer_parts: Option<Vec<models::ReservationOfferPart>>,
58    #[serde(rename = "ancillaryOfferParts", skip_serializing_if = "Option::is_none")]
59    pub ancillary_offer_parts: Option<Vec<models::AncillaryOfferPart>>,
60    #[serde(rename = "fees", skip_serializing_if = "Option::is_none")]
61    pub fees: Option<Vec<models::Fee>>,
62    #[serde(rename = "fares", skip_serializing_if = "Option::is_none")]
63    pub fares: Option<Vec<models::Fare>>,
64    ///  Java Property Name: 'links' 
65    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
66    pub _links: Option<Vec<models::Link>>,
67}
68
69impl ExchangeOffer {
70    pub fn new(exchange_fee: models::Price, exchange_price: models::Price, fulfillments: Vec<models::Fulfillment>, offer_id: String, created_on: String, pre_bookable_until: String, passenger_refs: Vec<String>, admission_offer_parts: Vec<models::AdmissionOfferPart>) -> ExchangeOffer {
71        ExchangeOffer {
72            exchange_fee: Box::new(exchange_fee),
73            accounting_ref: None,
74            exchange_price: Box::new(exchange_price),
75            refundable_amount: None,
76            amount_to_be_paid: None,
77            applied_overrule_code: None,
78            fulfillments,
79            offer_id,
80            summary: None,
81            offer_summary: None,
82            created_on,
83            pre_bookable_until,
84            passenger_refs,
85            products: None,
86            trip_coverage: None,
87            inbound_trip_coverage: None,
88            exchange_offer_breakdown: None,
89            admission_offer_parts,
90            reservation_offer_parts: None,
91            ancillary_offer_parts: None,
92            fees: None,
93            fares: None,
94            _links: None,
95        }
96    }
97}
98