Skip to main content

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