osdm_sys/models/
address.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/// Address : A descriptive data associated with a place that can be used to describe the unique geographical context of a place for the purposes of identifying it. may be refined as either a road address, a postal address or both. Provided by OJP. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Address {
17    /// Attribute is used as discriminator for inheritance between data types.
18    #[serde(rename = "objectType")]
19    pub object_type: String,
20    /// id  defining the place. The code is provided as URN, relative URNs are allowed with base path urn:uic:stn '0850000' 
21    #[serde(rename = "id")]
22    pub id: String,
23    /// For a place with ids in different reference systems, the alternative ids can be returned.  The reference system is encoded in the string. E.g.: 'urn:uic:std:80000', 'x_swe:stn:10000', 'ch:1:sloid:343434' 
24    #[serde(rename = "alternativeIds", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub alternative_ids: Option<Option<Vec<String>>>,
26    #[serde(rename = "geoPosition", skip_serializing_if = "Option::is_none")]
27    pub geo_position: Option<Box<models::GeoPosition>>,
28    #[serde(rename = "ref", skip_serializing_if = "Option::is_none")]
29    pub r#ref: Option<Box<models::PlaceRef>>,
30    /// Java Property Name: 'links' 
31    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
32    pub _links: Option<Vec<models::Link>>,
33    /// Name or description of address for use in passenger information. 
34    #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub name: Option<Option<String>>,
36    /// id of the address 
37    #[serde(rename = "code", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub code: Option<Option<String>>,
39    /// Country of the address. 
40    #[serde(rename = "countryName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
41    pub country_name: Option<Option<String>>,
42    /// ISO 3166-1 alpha-2 2 character country code 
43    #[serde(rename = "countryCode", skip_serializing_if = "Option::is_none")]
44    pub country_code: Option<String>,
45    /// Postal code of the address. 
46    #[serde(rename = "postCode", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
47    pub post_code: Option<Option<String>>,
48    /// City name 
49    #[serde(rename = "city", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
50    pub city: Option<Option<String>>,
51    /// TopographicPlace name of the address. If set it should at least contain the city name. 
52    #[serde(rename = "topographicPlaceName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
53    pub topographic_place_name: Option<Option<String>>,
54    /// Street name of the address. Can also contain the house number. 
55    #[serde(rename = "street", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
56    pub street: Option<Option<String>>,
57    /// House number of the address. House number can either be in this separate field, or can be contained in the street field. 
58    #[serde(rename = "houseNumber", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
59    pub house_number: Option<Option<String>>,
60}
61
62impl Address {
63    /// A descriptive data associated with a place that can be used to describe the unique geographical context of a place for the purposes of identifying it. may be refined as either a road address, a postal address or both. Provided by OJP. 
64    pub fn new(object_type: String, id: String) -> Address {
65        Address {
66            object_type,
67            id,
68            alternative_ids: None,
69            geo_position: None,
70            r#ref: None,
71            _links: None,
72            name: None,
73            code: None,
74            country_name: None,
75            country_code: None,
76            post_code: None,
77            city: None,
78            topographic_place_name: None,
79            street: None,
80            house_number: None,
81        }
82    }
83}
84