osdm_sys/models/
travel_validity.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/// TravelValidity : In distributor mode, travel validity data is needed to create barcode and control data (IRS 90918-4) even in case they have been checked during the on-line sale. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TravelValidity {
17    #[serde(rename = "validTravelDates", skip_serializing_if = "Option::is_none")]
18    pub valid_travel_dates: Option<Box<models::Calendar>>,
19    #[serde(rename = "validityRange")]
20    pub validity_range: Box<models::ValidityRange>,
21    /// time ranges excluded from the validity (e.g. off peak fulfillments) 
22    #[serde(rename = "excludedTimeRanges", skip_serializing_if = "Option::is_none")]
23    pub excluded_time_ranges: Option<Vec<models::ExcludedTimeRange>>,
24    /// number of allowed travel days (e.g. 3 travel days within 2 weeks) 
25    #[serde(rename = "numberOfTravelDays", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub number_of_travel_days: Option<Option<i32>>,
27    #[serde(rename = "returnConstraint", skip_serializing_if = "Option::is_none")]
28    pub return_constraint: Option<Box<models::ReturnConstraint>>,
29    #[serde(rename = "trainValidity", skip_serializing_if = "Option::is_none")]
30    pub train_validity: Option<Box<models::TrainValidity>>,
31    /// Type of usage, either as single trip or multiple trips. Unrestricted fares might be combined into single trips if appropriate. Values from the [Travel Validity Type Code List](https://osdm.io/spec/catalog-of-code-lists/#TravelValidityType)  Values from the [Tavel Validity Type Code List](https://osdm.io/spec/catalog-of-code-lists/#TravelValidityType) Listed values here are examples. 
32    #[serde(rename = "validityType", skip_serializing_if = "Option::is_none")]
33    pub validity_type: Option<String>,
34    #[serde(rename = "tripAllocationConstraint", skip_serializing_if = "Option::is_none")]
35    pub trip_allocation_constraint: Option<Box<models::TripAllocationConstraint>>,
36    #[serde(rename = "tripInterruptionConstraint", skip_serializing_if = "Option::is_none")]
37    pub trip_interruption_constraint: Option<Box<models::TripInterruptionConstraint>>,
38}
39
40impl TravelValidity {
41    /// In distributor mode, travel validity data is needed to create barcode and control data (IRS 90918-4) even in case they have been checked during the on-line sale. 
42    pub fn new(validity_range: models::ValidityRange) -> TravelValidity {
43        TravelValidity {
44            valid_travel_dates: None,
45            validity_range: Box::new(validity_range),
46            excluded_time_ranges: None,
47            number_of_travel_days: None,
48            return_constraint: None,
49            train_validity: None,
50            validity_type: None,
51            trip_allocation_constraint: None,
52            trip_interruption_constraint: None,
53        }
54    }
55}
56