osdm_sys/models/train_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/// TrainValidity : Validity depending on boarding / leaving of a train. The ticket is valid from departure until the destination station in the train if departure or destination is within the from - until range. The validation can reference the departure or the destination time to decide the validity (e.g. Eurail/Interrail passes currently use the departure for the validity on night trains).
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TrainValidity {
17 #[serde(rename = "from")]
18 pub from: String,
19 #[serde(rename = "until")]
20 pub until: String,
21 #[serde(rename = "carriers")]
22 pub carriers: Vec<String>,
23 #[serde(rename = "excludedServiceBrands", skip_serializing_if = "Option::is_none")]
24 pub excluded_service_brands: Option<Vec<String>>,
25 #[serde(rename = "includedServiceBrands", skip_serializing_if = "Option::is_none")]
26 pub included_service_brands: Option<Vec<String>>,
27 #[serde(rename = "scope")]
28 pub scope: models::TrainValidityScope,
29}
30
31impl TrainValidity {
32 /// Validity depending on boarding / leaving of a train. The ticket is valid from departure until the destination station in the train if departure or destination is within the from - until range. The validation can reference the departure or the destination time to decide the validity (e.g. Eurail/Interrail passes currently use the departure for the validity on night trains).
33 pub fn new(from: String, until: String, carriers: Vec<String>, scope: models::TrainValidityScope) -> TrainValidity {
34 TrainValidity {
35 from,
36 until,
37 carriers,
38 excluded_service_brands: None,
39 included_service_brands: None,
40 scope,
41 }
42 }
43}
44