osdm_sys/models/
trip_allocation_constraint.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/// TripAllocationConstraint : constraint on the use of a multiple trip ticket 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TripAllocationConstraint {
17    /// 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. 
18    #[serde(rename = "allocationUnit")]
19    pub allocation_unit: String,
20    /// maximum number of allowed units to be allocated 
21    #[serde(rename = "maxUnits", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22    pub max_units: Option<Option<i32>>,
23    /// multiples of this duration can be allocated 
24    #[serde(rename = "durationUnit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub duration_unit: Option<Option<String>>,
26    /// one of the listed processes is required for the allocation of a single trip 
27    #[serde(rename = "requiredProcesses")]
28    pub required_processes: Vec<String>,
29}
30
31impl TripAllocationConstraint {
32    /// constraint on the use of a multiple trip ticket 
33    pub fn new(allocation_unit: String, required_processes: Vec<String>) -> TripAllocationConstraint {
34        TripAllocationConstraint {
35            allocation_unit,
36            max_units: None,
37            duration_unit: None,
38            required_processes,
39        }
40    }
41}
42