osdm-sys 0.1.0-alpha.2

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};

/// 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. 
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct Address {
    /// Attribute is used as discriminator for inheritance between data types.
    #[serde(rename = "objectType")]
    pub object_type: String,
    /// id  defining the place. The code is provided as URN, relative URNs are allowed with base path urn:uic:stn '0850000' 
    #[serde(rename = "id")]
    pub id: String,
    /// 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' 
    #[serde(rename = "alternativeIds", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub alternative_ids: Option<Option<Vec<String>>>,
    #[serde(rename = "geoPosition", skip_serializing_if = "Option::is_none")]
    pub geo_position: Option<Box<models::GeoPosition>>,
    #[serde(rename = "ref", skip_serializing_if = "Option::is_none")]
    pub r#ref: Option<Box<models::PlaceRef>>,
    /// Java Property Name: 'links' 
    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
    pub _links: Option<Vec<models::Link>>,
    /// Name or description of address for use in passenger information. 
    #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub name: Option<Option<String>>,
    /// id of the address 
    #[serde(rename = "code", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub code: Option<Option<String>>,
    /// Country of the address. 
    #[serde(rename = "countryName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub country_name: Option<Option<String>>,
    /// ISO 3166-1 alpha-2 2 character country code 
    #[serde(rename = "countryCode", skip_serializing_if = "Option::is_none")]
    pub country_code: Option<String>,
    /// Postal code of the address. 
    #[serde(rename = "postCode", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub post_code: Option<Option<String>>,
    /// City name 
    #[serde(rename = "city", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub city: Option<Option<String>>,
    /// TopographicPlace name of the address. If set it should at least contain the city name. 
    #[serde(rename = "topographicPlaceName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub topographic_place_name: Option<Option<String>>,
    /// Street name of the address. Can also contain the house number. 
    #[serde(rename = "street", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub street: Option<Option<String>>,
    /// House number of the address. House number can either be in this separate field, or can be contained in the street field. 
    #[serde(rename = "houseNumber", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub house_number: Option<Option<String>>,
}

impl 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. 
    pub fn new(object_type: String, id: String) -> Address {
        Address {
            object_type,
            id,
            alternative_ids: None,
            geo_position: None,
            r#ref: None,
            _links: None,
            name: None,
            code: None,
            country_name: None,
            country_code: None,
            post_code: None,
            city: None,
            topographic_place_name: None,
            street: None,
            house_number: None,
        }
    }
}