osdm_sys/models/
trip_coverage.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/// TripCoverage : The trip coverage defines which part of the trip is covered by the offer, offer part, booking or booking part, respectively.  If neither coveredLegIds nor coveredSections are defined, the complete trip is covered. coveredLegIds and coveredSections are mutually exclusive, i.e. only one of the structures can be present.  If either coveredLegIds or coveredSections is defined, the sectionIndex field must be filled to indicate which part of the trip is covered by the respective OfferPart or BookingPart 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TripCoverage {
17    #[serde(rename = "coveredTripId")]
18    pub covered_trip_id: String,
19    /// Describes which part of the trip (in order) is covered by the OfferPart/BookingPart which contains this TripCoverage structure.  This needs to be filled if either coveredLegIds or coveredSections is present. 
20    #[serde(rename = "sectionIndex", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
21    pub section_index: Option<Option<i32>>,
22    /// Indicate which legs are covered by the specific offer. Not used for fares. 
23    #[serde(rename = "coveredLegIds", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub covered_leg_ids: Option<Option<Vec<String>>>,
25    #[serde(rename = "coveredSections", skip_serializing_if = "Option::is_none")]
26    pub covered_sections: Option<Vec<models::Section>>,
27}
28
29impl TripCoverage {
30    /// The trip coverage defines which part of the trip is covered by the offer, offer part, booking or booking part, respectively.  If neither coveredLegIds nor coveredSections are defined, the complete trip is covered. coveredLegIds and coveredSections are mutually exclusive, i.e. only one of the structures can be present.  If either coveredLegIds or coveredSections is defined, the sectionIndex field must be filled to indicate which part of the trip is covered by the respective OfferPart or BookingPart 
31    pub fn new(covered_trip_id: String) -> TripCoverage {
32        TripCoverage {
33            covered_trip_id,
34            section_index: None,
35            covered_leg_ids: None,
36            covered_sections: None,
37        }
38    }
39}
40