osdm_sys/models/
product.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/// Product : Structured description of the product, its name, comfort and sales / after-sales conditions 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Product {
17    /// id of the product 
18    #[serde(rename = "id")]
19    pub id: String,
20    /// A human-readable description of the product. 
21    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22    pub summary: Option<Option<String>>,
23    /// General product types harmonized across fare providers. (More to be added, use null for types not listed yet.) Values from the [Product Type Code List](https://osdm.io/spec/catalog-of-code-lists/#ProductTypes) Listed values here are examples. 
24    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
25    pub r#type: Option<String>,
26    /// The product code expressed in the provider system (could be a mapping from an even lower-level provider). 
27    #[serde(rename = "code")]
28    pub code: String,
29    /// Textual description of the product. 
30    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub description: Option<Option<String>>,
32    /// Identifies a company. For rail, a RICS company code or compatible ERA company code are used.  E.g.: 'urn:uic:rics:1185:000011' 
33    #[serde(rename = "owner")]
34    pub owner: String,
35    /// Structured description of the sales or after-sales conditions. 
36    #[serde(rename = "conditions", skip_serializing_if = "Option::is_none")]
37    pub conditions: Option<Vec<models::Condition>>,
38    #[serde(rename = "flexibility")]
39    pub flexibility: String,
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", skip_serializing_if = "Option::is_none")]
44    pub travel_class: Option<String>,
45    #[serde(rename = "fulfillmentOptions", skip_serializing_if = "Option::is_none")]
46    pub fulfillment_options: Option<Vec<models::FulfillmentOption>>,
47    #[serde(rename = "isTrainBound", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
48    pub is_train_bound: Option<Option<bool>>,
49    #[serde(rename = "isReturnProduct", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
50    pub is_return_product: Option<Option<bool>>,
51    #[serde(rename = "serviceConstraintText", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
52    pub service_constraint_text: Option<Option<String>>,
53    #[serde(rename = "carrierConstraintText", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
54    pub carrier_constraint_text: Option<Option<String>>,
55    #[serde(rename = "descriptiveTexts", skip_serializing_if = "Option::is_none")]
56    pub descriptive_texts: Option<Vec<models::TextElement>>,
57    /// Mapping to Tariff 42 of IRS-90918-3 (Hermes/Hosa). Helps the H2O converter in mapping offers to a requested tariff. See legacyReservationParameter.tariff in OSDM offline. 
58    #[serde(rename = "tariff", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
59    pub tariff: Option<Option<String>>,
60    #[serde(rename = "combinationTags", skip_serializing_if = "Option::is_none")]
61    pub combination_tags: Option<Vec<models::CombinationTag>>,
62    /// product tags associated with the product that can be used to search for offers. This can be omitted outside of the product master data service
63    #[serde(rename = "productTags", skip_serializing_if = "Option::is_none")]
64    pub product_tags: Option<Vec<String>>,
65    /// Java Property Name: 'links' 
66    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
67    pub _links: Option<Vec<models::Link>>,
68}
69
70impl Product {
71    /// Structured description of the product, its name, comfort and sales / after-sales conditions 
72    pub fn new(id: String, code: String, owner: String, flexibility: String) -> Product {
73        Product {
74            id,
75            summary: None,
76            r#type: None,
77            code,
78            description: None,
79            owner,
80            conditions: None,
81            flexibility,
82            service_class: None,
83            travel_class: None,
84            fulfillment_options: None,
85            is_train_bound: None,
86            is_return_product: None,
87            service_constraint_text: None,
88            carrier_constraint_text: None,
89            descriptive_texts: None,
90            tariff: None,
91            combination_tags: None,
92            product_tags: None,
93            _links: None,
94        }
95    }
96}
97