osdm_sys/models/trip_interruption_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/// TripInterruptionConstraint : rules on allowed trip interruptions. Interruptions due to a train change indicated by a trip search must not be included here.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TripInterruptionConstraint {
17 /// maximum number of allowed interruptions
18 #[serde(rename = "maxInterruptions")]
19 pub max_interruptions: i32,
20 /// maximum duration of one interruption
21 #[serde(rename = "maxDuration", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22 pub max_duration: Option<Option<String>>,
23 /// maximum duration of all interruptions on the route
24 #[serde(rename = "totalMaxDuration", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25 pub total_max_duration: Option<Option<String>>,
26 /// one of the listed processes is required for the interruption of the trip
27 #[serde(rename = "requiredProcesses")]
28 pub required_processes: Vec<String>,
29}
30
31impl TripInterruptionConstraint {
32 /// rules on allowed trip interruptions. Interruptions due to a train change indicated by a trip search must not be included here.
33 pub fn new(max_interruptions: i32, required_processes: Vec<String>) -> TripInterruptionConstraint {
34 TripInterruptionConstraint {
35 max_interruptions,
36 max_duration: None,
37 total_max_duration: None,
38 required_processes,
39 }
40 }
41}
42