osdm_sys/models/
zone_definition.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/// ZoneDefinition : Definition of a zone used to define regional validity. The area of the zone can be defined via a geo-polygon, a complete list of all contained stations or area codes from the NUTS code list. The carrier is either the carrier or transport authority responsible for the definition. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ZoneDefinition {
17    #[serde(rename = "id")]
18    pub id: String,
19    #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
20    pub name: Option<Option<String>>,
21    /// Identifies a company. For rail, a RICS company code or compatible ERA company code are used.  E.g.: 'urn:uic:rics:1185:000011' 
22    #[serde(rename = "carrier")]
23    pub carrier: String,
24    #[serde(rename = "polygon", skip_serializing_if = "Option::is_none")]
25    pub polygon: Option<Box<models::Polygon>>,
26    #[serde(rename = "nutsCodes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub nuts_codes: Option<Option<Vec<String>>>,
28    #[serde(rename = "places", skip_serializing_if = "Option::is_none")]
29    pub places: Option<Vec<models::PlaceRef>>,
30}
31
32impl ZoneDefinition {
33    /// Definition of a zone used to define regional validity. The area of the zone can be defined via a geo-polygon, a complete list of all contained stations or area codes from the NUTS code list. The carrier is either the carrier or transport authority responsible for the definition. 
34    pub fn new(id: String, carrier: String) -> ZoneDefinition {
35        ZoneDefinition {
36            id,
37            name: None,
38            carrier,
39            polygon: None,
40            nuts_codes: None,
41            places: None,
42        }
43    }
44}
45