osdm_sys/models/
compartment.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/// Compartment : Areas within a coach that holds places. Areas might be selectable as a whole. Usual areas would be classic compartments. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Compartment {
17    #[serde(rename = "places")]
18    pub places: Vec<models::PlacePosition>,
19    /// Compartment number
20    #[serde(rename = "number", skip_serializing_if = "Option::is_none")]
21    pub number: Option<String>,
22    /// Indicates whether compartments are selectable as a whole only 
23    #[serde(rename = "isSelectable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub is_selectable: Option<Option<bool>>,
25    /// references to the reservations/fares for which this place can be selected. The reservation ids must be part of the list of reservation ids for which the consumer has requested the available places and the consumer must accept a list by setting singleSelectionMapsRequired to false 
26    #[serde(rename = "reservationRefs", skip_serializing_if = "Option::is_none")]
27    pub reservation_refs: Option<Vec<String>>,
28    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
29    pub status: Option<models::AvailabilityStatus>,
30    /// Traditional first and second class. 
31    #[serde(rename = "travelClass", skip_serializing_if = "Option::is_none")]
32    pub travel_class: Option<String>,
33    /// 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. 
34    #[serde(rename = "serviceClass", skip_serializing_if = "Option::is_none")]
35    pub service_class: Option<String>,
36    #[serde(rename = "selectionFee", skip_serializing_if = "Option::is_none")]
37    pub selection_fee: Option<Box<models::SelectionFee>>,
38}
39
40impl Compartment {
41    /// Areas within a coach that holds places. Areas might be selectable as a whole. Usual areas would be classic compartments. 
42    pub fn new(places: Vec<models::PlacePosition>) -> Compartment {
43        Compartment {
44            places,
45            number: None,
46            is_selectable: None,
47            reservation_refs: None,
48            status: None,
49            travel_class: None,
50            service_class: None,
51            selection_fee: None,
52        }
53    }
54}
55