osdm_sys/models/
passenger_specification.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/// PassengerSpecification : Minimal specification of a passenger to request offers. Either the date of birth or the age at the time of travel needs to be set. We recommend to use date of birth as it is more stable than age. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct PassengerSpecification {
17    /// A stable reference to a passenger from other elements, or from caller system. When received in input of a request, it must be echoed back in the response. 
18    #[serde(rename = "externalRef")]
19    pub external_ref: String,
20    /// Date of birth of the passenger. Only needed for passengers of type persons, family child, PRM and wheelchair. 
21    #[serde(rename = "dateOfBirth", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22    pub date_of_birth: Option<Option<String>>,
23    #[serde(rename = "age", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub age: Option<Option<i32>>,
25    /// reduction or loyalty cards owned by the passenger 
26    #[serde(rename = "cards", skip_serializing_if = "Option::is_none")]
27    pub cards: Option<Vec<models::CardReference>>,
28    /// For the persons with reduced mobility (PRMs) its specific needs for support are expressed. 
29    #[serde(rename = "prmNeeds", skip_serializing_if = "Option::is_none")]
30    pub prm_needs: Option<Vec<String>>,
31    #[serde(rename = "detail", skip_serializing_if = "Option::is_none")]
32    pub detail: Option<Box<models::PersonDetail>>,
33    /// Passenger type according to UIC passenger, i.e. passenger type list. Values from the [Passenger Type Code List](https://osdm.io/spec/catalog-of-code-lists/#PassengerType) Listed values here are examples.    Proposed default PERSON 
34    #[serde(rename = "type")]
35    pub r#type: String,
36    #[serde(rename = "gender", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37    pub gender: Option<Option<models::Gender>>,
38    #[serde(rename = "transportableDetails", skip_serializing_if = "Option::is_none")]
39    pub transportable_details: Option<Box<models::Transportable>>,
40}
41
42impl PassengerSpecification {
43    /// Minimal specification of a passenger to request offers. Either the date of birth or the age at the time of travel needs to be set. We recommend to use date of birth as it is more stable than age. 
44    pub fn new(external_ref: String, r#type: String) -> PassengerSpecification {
45        PassengerSpecification {
46            external_ref,
47            date_of_birth: None,
48            age: None,
49            cards: None,
50            prm_needs: None,
51            detail: None,
52            r#type,
53            gender: None,
54            transportable_details: None,
55        }
56    }
57}
58