osdm-sys 0.1.0-alpha.3

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/)
Documentation
/*
 * UIC 90918-10 - OSDM
 *
 * 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/) 
 *
 * The version of the OpenAPI document: 3.7.0
 * Contact: osdm@uic.org
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// Trip : A complete trip from origin to destination. Provided by OJP. 
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct Trip {
    /// Id of this trip for referencing purposes. Unique within a trip list. 
    #[serde(rename = "id")]
    pub id: String,
    /// External reference of this trip for referencing purposes. 
    #[serde(rename = "externalRef", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub external_ref: Option<Option<String>>,
    /// A human-readable description of the trip. 
    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub summary: Option<Option<String>>,
    /// Overall duration of the trip 
    #[serde(rename = "duration")]
    pub duration: String,
    #[serde(rename = "direction", skip_serializing_if = "Option::is_none")]
    pub direction: Option<models::TripDirectionType>,
    #[serde(rename = "origin", skip_serializing_if = "Option::is_none")]
    pub origin: Option<Box<models::PlaceRef>>,
    /// Name of the origin place
    #[serde(rename = "originName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub origin_name: Option<Option<String>>,
    #[serde(rename = "destination", skip_serializing_if = "Option::is_none")]
    pub destination: Option<Box<models::PlaceRef>>,
    /// Name of the destination place
    #[serde(rename = "destinationName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub destination_name: Option<Option<String>>,
    /// Departure time at origin. 
    #[serde(rename = "startTime")]
    pub start_time: String,
    /// Arrival time at destination 
    #[serde(rename = "endTime")]
    pub end_time: String,
    /// Number of interchanges 
    #[serde(rename = "transfers")]
    pub transfers: i32,
    /// Distance in meters over the the complete trip, i.e., including transfer legs. 
    #[serde(rename = "distance", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub distance: Option<Option<i32>>,
    /// Legs ot the trip 
    #[serde(rename = "legs")]
    pub legs: Vec<models::TripLeg>,
    #[serde(rename = "operatingDays", skip_serializing_if = "Option::is_none")]
    pub operating_days: Option<Box<models::OperatingDays>>,
    /// Textual description of the operation days, e.g. 'Monday to Friday' or 'Not on holidays'. 
    #[serde(rename = "operatingDaysDescription", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub operating_days_description: Option<Option<String>>,
    #[serde(rename = "situationFullRefs", skip_serializing_if = "Option::is_none")]
    pub situation_full_refs: Option<Vec<String>>,
    #[serde(rename = "tripStatus", skip_serializing_if = "Option::is_none")]
    pub trip_status: Option<Box<models::TripStatus>>,
    ///  Java Property Name: 'links' 
    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
    pub _links: Option<Vec<models::Link>>,
}

impl Trip {
    /// A complete trip from origin to destination. Provided by OJP. 
    pub fn new(id: String, duration: String, start_time: String, end_time: String, transfers: i32, legs: Vec<models::TripLeg>) -> Trip {
        Trip {
            id,
            external_ref: None,
            summary: None,
            duration,
            direction: None,
            origin: None,
            origin_name: None,
            destination: None,
            destination_name: None,
            start_time,
            end_time,
            transfers,
            distance: None,
            legs,
            operating_days: None,
            operating_days_description: None,
            situation_full_refs: None,
            trip_status: None,
            _links: None,
        }
    }
}