osdm_sys/models/
offer_summary.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/// OfferSummary : The offer summary indicates the most relevant service class, level, flexibility or accommodation that describe this offer, but this does not imply that these values exactly apply to all parts of the offer. Let's consider, as a simplified example, a trip composed of two legs, one with both 1st and 2nd class, and one with only 2nd. On this trip, the railway is expected to propose one offer with overallServiceClass FIRST composed of one admission in 1st class on the first legs and one admission in 2nd class on the second one, plus a second offer with overallServiceClass SECOND composed of two second class admissions. Likewise for all 'overall' attributes. The purpose of these attributes is to convey to the client system the service class, level, flexibility and accommodation that best represent this offer so to facilitate presentation to the final user. The offerSummary must be provided for product based offers. It is not needed for fares. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OfferSummary {
17    #[serde(rename = "minimalPrice")]
18    pub minimal_price: Box<models::Price>,
19    #[serde(rename = "overallServiceClass")]
20    pub overall_service_class: Box<models::ServiceClass>,
21    /// Traditional first and second class. 
22    #[serde(rename = "overallTravelClass", skip_serializing_if = "Option::is_none")]
23    pub overall_travel_class: Option<String>,
24    /// Accommodation type definition out of the  [Accommodation Type Code List](https://osdm.io/spec/catalog-of-code-lists/#AccomodationType) Listed values here are examples. 
25    #[serde(rename = "overallAccommodationType", skip_serializing_if = "Option::is_none")]
26    pub overall_accommodation_type: Option<String>,
27    /// Accommodation sub type definition out of the  [Accommodation Sub Type Code List](https://osdm.io/spec/catalog-of-code-lists/#PlaceProperty) Listed values here are examples. 
28    #[serde(rename = "overallAccommodationSubType", skip_serializing_if = "Option::is_none")]
29    pub overall_accommodation_sub_type: Option<String>,
30    #[serde(rename = "overallFlexibility")]
31    pub overall_flexibility: String,
32    #[serde(rename = "minimalIndicatedConsumption", skip_serializing_if = "Option::is_none")]
33    pub minimal_indicated_consumption: Option<Box<models::IndicatedConsumption>>,
34}
35
36impl OfferSummary {
37    /// The offer summary indicates the most relevant service class, level, flexibility or accommodation that describe this offer, but this does not imply that these values exactly apply to all parts of the offer. Let's consider, as a simplified example, a trip composed of two legs, one with both 1st and 2nd class, and one with only 2nd. On this trip, the railway is expected to propose one offer with overallServiceClass FIRST composed of one admission in 1st class on the first legs and one admission in 2nd class on the second one, plus a second offer with overallServiceClass SECOND composed of two second class admissions. Likewise for all 'overall' attributes. The purpose of these attributes is to convey to the client system the service class, level, flexibility and accommodation that best represent this offer so to facilitate presentation to the final user. The offerSummary must be provided for product based offers. It is not needed for fares. 
38    pub fn new(minimal_price: models::Price, overall_service_class: models::ServiceClass, overall_flexibility: String) -> OfferSummary {
39        OfferSummary {
40            minimal_price: Box::new(minimal_price),
41            overall_service_class: Box::new(overall_service_class),
42            overall_travel_class: None,
43            overall_accommodation_type: None,
44            overall_accommodation_sub_type: None,
45            overall_flexibility,
46            minimal_indicated_consumption: None,
47        }
48    }
49}
50