osdm_sys/models/fare_combination_model.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/// FareCombinationModel : Defines the model according to which the fares can be combined.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
17pub struct FareCombinationModel {
18 /// A distributor needs to support the following models: SEPARATE_TICKET, SEPARATE_CONTRACT, CLUSTERING, COMBINING.
19 #[serde(rename = "model")]
20 pub model: String,
21 /// List of all carriers where the model can be applied, in case the list is empty all combinations are allowed.
22 #[serde(rename = "combinableCarriers", skip_serializing_if = "Option::is_none")]
23 pub combinable_carriers: Option<Vec<String>>,
24 /// This combination model applies only in case the fare is combined with another carrier
25 #[serde(rename = "isValidOnlyWhenCombined", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26 pub is_valid_only_when_combined: Option<Option<bool>>,
27 /// In case of CLUSTERING model: the cluster to which the fare belongs
28 #[serde(rename = "referenceCluster", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29 pub reference_cluster: Option<Option<String>>,
30 /// In case of CLUSTERING model: the other clusters that allow a combination
31 #[serde(rename = "allowedClusters", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
32 pub allowed_clusters: Option<Option<Vec<String>>>,
33 /// List of carriers where a common contract with separate fulfillments are allowed.
34 #[serde(rename = "allowedCommonContracts", skip_serializing_if = "Option::is_none")]
35 pub allowed_common_contracts: Option<Vec<String>>,
36}
37
38impl FareCombinationModel {
39 /// Defines the model according to which the fares can be combined.
40 pub fn new(model: String) -> FareCombinationModel {
41 FareCombinationModel {
42 model,
43 combinable_carriers: None,
44 is_valid_only_when_combined: None,
45 reference_cluster: None,
46 allowed_clusters: None,
47 allowed_common_contracts: None,
48 }
49 }
50}
51