osdm_sys/models/
booking.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 Booking {
16    #[serde(rename = "id")]
17    pub id: String,
18    /// The unique booking code in the provider system. Usually refers to an order number or PNR.
19    #[serde(rename = "bookingCode", skip_serializing_if = "Option::is_none")]
20    pub booking_code: Option<String>,
21    /// The unique booking reference in the provider system. Usually refers to an order number or PNR. 
22    #[serde(rename = "externalRef", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
23    pub external_ref: Option<Option<String>>,
24    /// A human-readable description of the booking. 
25    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub summary: Option<Option<String>>,
27    #[serde(rename = "createdOn")]
28    pub created_on: String,
29    #[serde(rename = "passengers")]
30    pub passengers: Vec<models::Passenger>,
31    #[serde(rename = "purchaser", skip_serializing_if = "Option::is_none")]
32    pub purchaser: Option<Box<models::Purchaser>>,
33    #[serde(rename = "provisionalPrice", skip_serializing_if = "Option::is_none")]
34    pub provisional_price: Option<Box<models::Price>>,
35    #[serde(rename = "provisionalRefundAmount", skip_serializing_if = "Option::is_none")]
36    pub provisional_refund_amount: Option<Box<models::Price>>,
37    #[serde(rename = "confirmedPrice", skip_serializing_if = "Option::is_none")]
38    pub confirmed_price: Option<Box<models::Price>>,
39    #[serde(rename = "bookedOffers", skip_serializing_if = "Option::is_none")]
40    pub booked_offers: Option<Vec<models::BookedOffer>>,
41    /// This trip will be included in the offer if the offer is part of the booking. 
42    #[serde(rename = "trips", skip_serializing_if = "Option::is_none")]
43    pub trips: Option<Vec<models::Trip>>,
44    /// Boolean-expression indicating the data that must be set in the data model in order to proceed to next step of the process.   The syntax and semantics of the expression is described in detail in the OSDM documentation. 
45    #[serde(rename = "requestedInformation", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
46    pub requested_information: Option<Option<String>>,
47    /// Time until the booking needs to be confirmed or put on hold. After that, the booking is no longer valid. 
48    #[serde(rename = "confirmationTimeLimit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49    pub confirmation_time_limit: Option<Option<String>>,
50    /// Values from the [Fulfillment Type Code List](https://osdm.io/spec/catalog-of-code-lists/#FulfillmentType) Listed values here are examples. 
51    #[serde(rename = "fulfillmentType", skip_serializing_if = "Option::is_none")]
52    pub fulfillment_type: Option<String>,
53    #[serde(rename = "fulfillments", skip_serializing_if = "Option::is_none")]
54    pub fulfillments: Option<Vec<models::Fulfillment>>,
55    #[serde(rename = "fulfillmentStatus", skip_serializing_if = "Option::is_none")]
56    pub fulfillment_status: Option<String>,
57    #[serde(rename = "issuedVouchers", skip_serializing_if = "Option::is_none")]
58    pub issued_vouchers: Option<Vec<models::VoucherInformation>>,
59    #[serde(rename = "documents", skip_serializing_if = "Option::is_none")]
60    pub documents: Option<Vec<models::Document>>,
61    #[serde(rename = "paymentMethods", skip_serializing_if = "Option::is_none")]
62    pub payment_methods: Option<Vec<models::PaymentMethod>>,
63    /// Refund offers are created with the details of the to-be-confirmed refund operation. One refund offer can then be confirmed, which turns it into a refund. Refund offers in state PROPOSED might not be available in the Booking but only via the get endpoint. Confirmed refund offers must be listed here. 
64    #[serde(rename = "refundOffers", skip_serializing_if = "Option::is_none")]
65    pub refund_offers: Option<Vec<models::RefundOffer>>,
66    #[serde(rename = "releaseOffers", skip_serializing_if = "Option::is_none")]
67    pub release_offers: Option<Vec<models::ReleaseOffer>>,
68    #[serde(rename = "cancelFulfillmentsOffers", skip_serializing_if = "Option::is_none")]
69    pub cancel_fulfillments_offers: Option<Vec<models::CancelFulfillmentsOffer>>,
70    #[serde(rename = "exchangeOperations", skip_serializing_if = "Option::is_none")]
71    pub exchange_operations: Option<Vec<models::ExchangeOperation>>,
72    #[serde(rename = "onHoldOffer", skip_serializing_if = "Option::is_none")]
73    pub on_hold_offer: Option<Box<models::OnHoldOffer>>,
74    /// If this booking has been split, this attribute references the newly created bookingIds. 
75    #[serde(rename = "relatedBookingIds", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
76    pub related_booking_ids: Option<Option<Vec<String>>>,
77    /// Java Property Name: 'links' 
78    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
79    pub _links: Option<Vec<models::Link>>,
80}
81
82impl Booking {
83    pub fn new(id: String, created_on: String, passengers: Vec<models::Passenger>) -> Booking {
84        Booking {
85            id,
86            booking_code: None,
87            external_ref: None,
88            summary: None,
89            created_on,
90            passengers,
91            purchaser: None,
92            provisional_price: None,
93            provisional_refund_amount: None,
94            confirmed_price: None,
95            booked_offers: None,
96            trips: None,
97            requested_information: None,
98            confirmation_time_limit: None,
99            fulfillment_type: None,
100            fulfillments: None,
101            fulfillment_status: None,
102            issued_vouchers: None,
103            documents: None,
104            payment_methods: None,
105            refund_offers: None,
106            release_offers: None,
107            cancel_fulfillments_offers: None,
108            exchange_operations: None,
109            on_hold_offer: None,
110            related_booking_ids: None,
111            _links: None,
112        }
113    }
114}
115