osdm_sys/models/
fare.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/// Fare : The online representation of a fare. In case the final product requires the indication of carriers it is obligatory to provide a  carrierConstraint in the fare directly that includes the list of all carriers in the  includedCarrier list. Whether the carrier must be indicated needs to be derived from the requested total route and the location of the sales points for international sales.  Whether the indication of carriers is obligatory is defined in the Convention concerning International Carriage by Rail (COTIF). 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Fare {
17    /// id of the fare item to be included in accounting 
18    #[serde(rename = "id")]
19    pub id: String,
20    /// Basic UIC fare types used in 90918-10, 90918-4, and 90918-9. Values from the [Fare Type Code List](https://osdm.io/spec/catalog-of-code-lists/#FareType) Listed values here are examples. 
21    #[serde(rename = "type")]
22    pub r#type: String,
23    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
24    pub name: Option<Box<models::Text>>,
25    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
26    pub description: Option<Box<models::Text>>,
27    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
28    pub status: Option<models::BookingPartStatus>,
29    /// allows specifying a price in multiple currencies 
30    #[serde(rename = "prices")]
31    pub prices: Vec<models::Price>,
32    #[serde(rename = "regionalConstraint")]
33    pub regional_constraint: Box<models::RegionalConstraint>,
34    #[serde(rename = "serviceConstraint", skip_serializing_if = "Option::is_none")]
35    pub service_constraint: Option<Box<models::ServiceConstraint>>,
36    #[serde(rename = "carrierConstraint", skip_serializing_if = "Option::is_none")]
37    pub carrier_constraint: Option<Box<models::CarrierConstraint>>,
38    #[serde(rename = "regulatoryConditions", skip_serializing_if = "Option::is_none")]
39    pub regulatory_conditions: Option<Vec<models::RegulatoryCondition>>,
40    #[serde(rename = "serviceClass", skip_serializing_if = "Option::is_none")]
41    pub service_class: Option<Box<models::ServiceClass>>,
42    /// Traditional first and second class. 
43    #[serde(rename = "travelClass")]
44    pub travel_class: String,
45    #[serde(rename = "afterSalesCondition")]
46    pub after_sales_condition: Box<models::AfterSalesConditionsLink>,
47    #[serde(rename = "combinationConstraint")]
48    pub combination_constraint: Vec<models::FareCombinationModel>,
49    #[serde(rename = "fulfillmentConstraint", skip_serializing_if = "Option::is_none")]
50    pub fulfillment_constraint: Option<Box<models::FulfillmentConstraint>>,
51    #[serde(rename = "travelValidityConstraint")]
52    pub travel_validity_constraint: Box<models::TravelValidity>,
53    #[serde(rename = "availablePlaces", skip_serializing_if = "Option::is_none")]
54    pub available_places: Option<Vec<models::AvailablePlace>>,
55    #[serde(rename = "placeSelection", skip_serializing_if = "Option::is_none")]
56    pub place_selection: Option<Box<models::PlaceSelection>>,
57    #[serde(rename = "placeAllocation", skip_serializing_if = "Option::is_none")]
58    pub place_allocation: Option<Vec<models::PlaceAllocation>>,
59    #[serde(rename = "coveredSection", skip_serializing_if = "Option::is_none")]
60    pub covered_section: Option<Box<models::Section>>,
61    #[serde(rename = "passengerRefs", skip_serializing_if = "Option::is_none")]
62    pub passenger_refs: Option<Vec<String>>,
63    /// passenger constraint to be included in bar codes 
64    #[serde(rename = "passengerConstraints", skip_serializing_if = "Option::is_none")]
65    pub passenger_constraints: Option<Vec<models::PassengerConstraints>>,
66    #[serde(rename = "involvedTCOs", skip_serializing_if = "Option::is_none")]
67    pub involved_tcos: Option<Vec<String>>,
68    #[serde(rename = "accountingRef", skip_serializing_if = "Option::is_none")]
69    pub accounting_ref: Option<Box<models::AccountingRef>>,
70    #[serde(rename = "legacyAccountingIdentifier", skip_serializing_if = "Option::is_none")]
71    pub legacy_accounting_identifier: Option<Box<models::LegacyAccountingIdentifier>>,
72    #[serde(rename = "legacyReservationParameter", skip_serializing_if = "Option::is_none")]
73    pub legacy_reservation_parameter: Option<Box<models::LegacyReservationParameter>>,
74    /// One of the listed cards is required to be valid at the time of travel. 
75    #[serde(rename = "requiredCards", skip_serializing_if = "Option::is_none")]
76    pub required_cards: Option<Vec<models::CardReference>>,
77    #[serde(rename = "luggageConstraint", skip_serializing_if = "Option::is_none")]
78    pub luggage_constraint: Option<Box<models::LuggageConstraint>>,
79    #[serde(rename = "availablePreferences", skip_serializing_if = "Option::is_none")]
80    pub available_preferences: Option<Vec<models::AvailablePlacePreferences>>,
81}
82
83impl Fare {
84    /// The online representation of a fare. In case the final product requires the indication of carriers it is obligatory to provide a  carrierConstraint in the fare directly that includes the list of all carriers in the  includedCarrier list. Whether the carrier must be indicated needs to be derived from the requested total route and the location of the sales points for international sales.  Whether the indication of carriers is obligatory is defined in the Convention concerning International Carriage by Rail (COTIF). 
85    pub fn new(id: String, r#type: String, prices: Vec<models::Price>, regional_constraint: models::RegionalConstraint, travel_class: String, after_sales_condition: models::AfterSalesConditionsLink, combination_constraint: Vec<models::FareCombinationModel>, travel_validity_constraint: models::TravelValidity) -> Fare {
86        Fare {
87            id,
88            r#type,
89            name: None,
90            description: None,
91            status: None,
92            prices,
93            regional_constraint: Box::new(regional_constraint),
94            service_constraint: None,
95            carrier_constraint: None,
96            regulatory_conditions: None,
97            service_class: None,
98            travel_class,
99            after_sales_condition: Box::new(after_sales_condition),
100            combination_constraint,
101            fulfillment_constraint: None,
102            travel_validity_constraint: Box::new(travel_validity_constraint),
103            available_places: None,
104            place_selection: None,
105            place_allocation: None,
106            covered_section: None,
107            passenger_refs: None,
108            passenger_constraints: None,
109            involved_tcos: None,
110            accounting_ref: None,
111            legacy_accounting_identifier: None,
112            legacy_reservation_parameter: None,
113            required_cards: None,
114            luggage_constraint: None,
115            available_preferences: None,
116        }
117    }
118}
119