osdm_sys/models/
timed_leg.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/// TimedLeg : A leg which is bound to a timetabled schedule. Corresponds to a ride. Provided by OJP. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TimedLeg {
17    #[serde(rename = "start")]
18    pub start: Box<models::Board>,
19    #[serde(rename = "intermediates", skip_serializing_if = "Option::is_none")]
20    pub intermediates: Option<Vec<models::Intermediate>>,
21    #[serde(rename = "end")]
22    pub end: Box<models::Alight>,
23    #[serde(rename = "service")]
24    pub service: Box<models::DatedJourney>,
25    #[serde(rename = "operatingDays", skip_serializing_if = "Option::is_none")]
26    pub operating_days: Option<Box<models::OperatingDays>>,
27    /// Textual description of the operation days, e.g. 'Monday to Friday' or 'not on holidays'. 
28    #[serde(rename = "operatingDaysDescription", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub operating_days_description: Option<Option<String>>,
30    #[serde(rename = "duration", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub duration: Option<Option<String>>,
32    #[serde(rename = "co2Emission", skip_serializing_if = "Option::is_none")]
33    pub co2_emission: Option<Box<models::Quantity>>,
34    #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")]
35    pub attributes: Option<Vec<models::LegAttribute>>,
36}
37
38impl TimedLeg {
39    /// A leg which is bound to a timetabled schedule. Corresponds to a ride. Provided by OJP. 
40    pub fn new(start: models::Board, end: models::Alight, service: models::DatedJourney) -> TimedLeg {
41        TimedLeg {
42            start: Box::new(start),
43            intermediates: None,
44            end: Box::new(end),
45            service: Box::new(service),
46            operating_days: None,
47            operating_days_description: None,
48            duration: None,
49            co2_emission: None,
50            attributes: None,
51        }
52    }
53}
54