osdm_sys/models/
compartment_availability.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/// CompartmentAvailability : Area within a coach deck that holds places. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CompartmentAvailability {
17    /// Type of quality level, finer grained than the comfort class. Values from the [Service Class Code List](https://osdm.io/spec/catalog-of-code-lists/#ServiceClass) Listed values here are examples. 
18    #[serde(rename = "serviceClass")]
19    pub service_class: String,
20    /// Accommodation type definition out of the  [Accommodation Type Code List](https://osdm.io/spec/catalog-of-code-lists/#AccomodationType) Listed values here are examples. 
21    #[serde(rename = "accommodationType")]
22    pub accommodation_type: String,
23    /// Accommodation sub type definition out of the  [Accommodation Sub Type Code List](https://osdm.io/spec/catalog-of-code-lists/#PlaceProperty) Listed values here are examples. 
24    #[serde(rename = "accommodationSubType")]
25    pub accommodation_sub_type: String,
26    /// Seats or bicycle hooks in a coach compartment that are covered by a requested reservation fare/offerPart/bookingPart. No place availabilities must be returned for places that are NOT covered by a requested offer. 
27    #[serde(rename = "places")]
28    pub places: Vec<models::SpecificPlaceAvailability>,
29    /// Indicates whether the compartment is selectable as a whole only. 
30    #[serde(rename = "isSelectable")]
31    pub is_selectable: bool,
32    /// Compartment number as indicated at the compartment in the coach. A compartment number must be set if the compartment is selectable as a whole only. 
33    #[serde(rename = "number", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub number: Option<Option<String>>,
35    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
36    pub status: Option<models::AvailabilityStatus>,
37    /// reservationRefs must be set if the compartment is selectable as a whole only 
38    #[serde(rename = "reservationRefs", skip_serializing_if = "Option::is_none")]
39    pub reservation_refs: Option<Vec<models::ReservationReference>>,
40    #[serde(rename = "selectionFee", skip_serializing_if = "Option::is_none")]
41    pub selection_fee: Option<Box<models::SelectionFee>>,
42}
43
44impl CompartmentAvailability {
45    /// Area within a coach deck that holds places. 
46    pub fn new(service_class: String, accommodation_type: String, accommodation_sub_type: String, places: Vec<models::SpecificPlaceAvailability>, is_selectable: bool) -> CompartmentAvailability {
47        CompartmentAvailability {
48            service_class,
49            accommodation_type,
50            accommodation_sub_type,
51            places,
52            is_selectable,
53            number: None,
54            status: None,
55            reservation_refs: None,
56            selection_fee: None,
57        }
58    }
59}
60