1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* UIC 90918-10 - OSDM
*
* 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/)
*
* The version of the OpenAPI document: 3.7.0
* Contact: osdm@uic.org
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// TripAllocationConstraint : constraint on the use of a multiple trip ticket
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct TripAllocationConstraint {
/// Values from the [Trip Allocation Unit Code List](https://osdm.io/spec/catalog-of-code-lists/#TripAllocationUnit) Unit to allocate trips in a multi-trip fare. Trips can be allocated per day (e.g. Eurail) or per duration (e.g. multiples of a duration unit to cover the trip) or as single trips (e.g. carnet)) Known Values: - NONE: Individual trips don't need to be allocated. - TRIP: allocation per individual trip. - DAY: The allocation is per travel day. - DURATION: the allocation is per duration.
#[serde(rename = "allocationUnit")]
pub allocation_unit: String,
/// maximum number of allowed units to be allocated
#[serde(rename = "maxUnits", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub max_units: Option<Option<i32>>,
/// multiples of this duration can be allocated
#[serde(rename = "durationUnit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub duration_unit: Option<Option<String>>,
/// one of the listed processes is required for the allocation of a single trip
#[serde(rename = "requiredProcesses")]
pub required_processes: Vec<String>,
}
impl TripAllocationConstraint {
/// constraint on the use of a multiple trip ticket
pub fn new(allocation_unit: String, required_processes: Vec<String>) -> TripAllocationConstraint {
TripAllocationConstraint {
allocation_unit,
max_units: None,
duration_unit: None,
required_processes,
}
}
}