osdm_sys/models/anonymous_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/// AnonymousPassengerSpecification : Minimal specification of a passenger to request offers without any GDPR relevant attributes such as name or address. 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)]
16#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
17pub struct AnonymousPassengerSpecification {
18 /// 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.
19 #[serde(rename = "externalRef")]
20 pub external_ref: String,
21 /// Date of birth of the passenger. Only needed for passengers of type persons, family child, PRM and wheelchair.
22 #[serde(rename = "dateOfBirth", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
23 pub date_of_birth: Option<Option<String>>,
24 #[serde(rename = "age", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25 pub age: Option<Option<i32>>,
26 /// 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
27 #[serde(rename = "type")]
28 pub r#type: String,
29 #[serde(rename = "prmNeeds", skip_serializing_if = "Option::is_none")]
30 pub prm_needs: Option<Vec<String>>,
31 #[serde(rename = "cards", skip_serializing_if = "Option::is_none")]
32 pub cards: Option<Vec<models::CardReference>>,
33 #[serde(rename = "gender", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34 pub gender: Option<Option<models::Gender>>,
35 /// ISO 3166-1 alpha-2 2 character country code
36 #[serde(rename = "residency", skip_serializing_if = "Option::is_none")]
37 pub residency: Option<String>,
38 #[serde(rename = "transportable", skip_serializing_if = "Option::is_none")]
39 pub transportable: Option<Box<models::TransportableSpecification>>,
40}
41
42impl AnonymousPassengerSpecification {
43 /// Minimal specification of a passenger to request offers without any GDPR relevant attributes such as name or address. 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) -> AnonymousPassengerSpecification {
45 AnonymousPassengerSpecification {
46 external_ref,
47 date_of_birth: None,
48 age: None,
49 r#type,
50 prm_needs: None,
51 cards: None,
52 gender: None,
53 residency: None,
54 transportable: None,
55 }
56 }
57}
58