osdm_sys/models/
passenger.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/// Passenger : Information about a passenger.  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 Passenger {
17    #[serde(rename = "id")]
18    pub id: String,
19    /// A human-readable description of the passenger. 
20    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
21    pub summary: Option<Option<String>>,
22    /// A stable reference to a passenger from other elements, or from caller system. When passed in passenger specification in an offer request, it must be echoed back in the response. 
23    #[serde(rename = "externalRef")]
24    pub external_ref: String,
25    /// date of birth of the passenger 
26    #[serde(rename = "dateOfBirth", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub date_of_birth: Option<Option<String>>,
28    #[serde(rename = "age", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub age: Option<Option<i32>>,
30    /// 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 
31    #[serde(rename = "type")]
32    pub r#type: String,
33    /// reduction or loyalty cards owned by the passenger 
34    #[serde(rename = "cards", skip_serializing_if = "Option::is_none")]
35    pub cards: Option<Vec<models::CardReference>>,
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 = "detail", skip_serializing_if = "Option::is_none")]
39    pub detail: Option<Box<models::PersonDetail>>,
40    #[serde(rename = "identificationCard", skip_serializing_if = "Option::is_none")]
41    pub identification_card: Option<Box<models::IdentificationCard>>,
42    #[serde(rename = "transportableDetails", skip_serializing_if = "Option::is_none")]
43    pub transportable_details: Option<Box<models::Transportable>>,
44    /// For the persons with reduced mobility (PRMs) its specific needs for support are expressed. 
45    #[serde(rename = "prmNeeds", skip_serializing_if = "Option::is_none")]
46    pub prm_needs: Option<Vec<String>>,
47    /// Java Property Name: 'links' 
48    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
49    pub _links: Option<Vec<models::Link>>,
50}
51
52impl Passenger {
53    /// Information about a passenger.  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. 
54    pub fn new(id: String, external_ref: String, r#type: String) -> Passenger {
55        Passenger {
56            id,
57            summary: None,
58            external_ref,
59            date_of_birth: None,
60            age: None,
61            r#type,
62            cards: None,
63            gender: None,
64            detail: None,
65            identification_card: None,
66            transportable_details: None,
67            prm_needs: None,
68            _links: None,
69        }
70    }
71}
72