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