osdm_sys/models/
trip.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/// Trip : A complete trip from origin to destination. Provided by OJP. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Trip {
17    /// Id of this trip for referencing purposes. Unique within a trip list. 
18    #[serde(rename = "id")]
19    pub id: String,
20    /// External reference of this trip for referencing purposes. 
21    #[serde(rename = "externalRef", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22    pub external_ref: Option<Option<String>>,
23    /// A human-readable description of the trip. 
24    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub summary: Option<Option<String>>,
26    /// Overall duration of the trip 
27    #[serde(rename = "duration")]
28    pub duration: String,
29    #[serde(rename = "direction", skip_serializing_if = "Option::is_none")]
30    pub direction: Option<models::TripDirectionType>,
31    #[serde(rename = "origin", skip_serializing_if = "Option::is_none")]
32    pub origin: Option<Box<models::PlaceRef>>,
33    /// Name of the origin place
34    #[serde(rename = "originName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub origin_name: Option<Option<String>>,
36    #[serde(rename = "destination", skip_serializing_if = "Option::is_none")]
37    pub destination: Option<Box<models::PlaceRef>>,
38    /// Name of the destination place
39    #[serde(rename = "destinationName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
40    pub destination_name: Option<Option<String>>,
41    /// Departure time at origin. 
42    #[serde(rename = "startTime")]
43    pub start_time: String,
44    /// Arrival time at destination 
45    #[serde(rename = "endTime")]
46    pub end_time: String,
47    /// Number of interchanges 
48    #[serde(rename = "transfers")]
49    pub transfers: i32,
50    /// Distance in meters over the the complete trip, i.e., including transfer legs. 
51    #[serde(rename = "distance", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
52    pub distance: Option<Option<i32>>,
53    /// Legs ot the trip 
54    #[serde(rename = "legs")]
55    pub legs: Vec<models::TripLeg>,
56    #[serde(rename = "operatingDays", skip_serializing_if = "Option::is_none")]
57    pub operating_days: Option<Box<models::OperatingDays>>,
58    /// Textual description of the operation days, e.g. 'Monday to Friday' or 'Not on holidays'. 
59    #[serde(rename = "operatingDaysDescription", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
60    pub operating_days_description: Option<Option<String>>,
61    #[serde(rename = "situationFullRefs", skip_serializing_if = "Option::is_none")]
62    pub situation_full_refs: Option<Vec<String>>,
63    #[serde(rename = "tripStatus", skip_serializing_if = "Option::is_none")]
64    pub trip_status: Option<Box<models::TripStatus>>,
65    ///  Java Property Name: 'links' 
66    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
67    pub _links: Option<Vec<models::Link>>,
68}
69
70impl Trip {
71    /// A complete trip from origin to destination. Provided by OJP. 
72    pub fn new(id: String, duration: String, start_time: String, end_time: String, transfers: i32, legs: Vec<models::TripLeg>) -> Trip {
73        Trip {
74            id,
75            external_ref: None,
76            summary: None,
77            duration,
78            direction: None,
79            origin: None,
80            origin_name: None,
81            destination: None,
82            destination_name: None,
83            start_time,
84            end_time,
85            transfers,
86            distance: None,
87            legs,
88            operating_days: None,
89            operating_days_description: None,
90            situation_full_refs: None,
91            trip_status: None,
92            _links: None,
93        }
94    }
95}
96