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

/// PersonDetail : Personal information potentially needed at booking step. To support privacy by design, it is not permitted to send personal information not required to create a valid booking. Note that address is deprecated in favor of `postalAddress`, and email and phoneNumber  are deprecated in favor of the attributes in `ContactDetail` 
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct PersonDetail {
    /// ISO-639-1 language code 
    #[serde(rename = "preferredLanguage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub preferred_language: Option<Option<String>>,
    /// A human-readable description of the person. 
    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub summary: Option<Option<String>>,
    #[serde(rename = "firstName")]
    pub first_name: String,
    /// full last names of the person
    #[serde(rename = "lastName")]
    pub last_name: String,
    /// first family name in case of multiple family names. The element lastName includes all family names.
    #[serde(rename = "firstFamilyName", skip_serializing_if = "Option::is_none")]
    pub first_family_name: Option<String>,
    /// second family name in case of multiple family names. The element lastName includes all family names.
    #[serde(rename = "secondFamilyName", skip_serializing_if = "Option::is_none")]
    pub second_family_name: Option<String>,
    #[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub email: Option<Option<String>>,
    /// Preferably a mobile phone number, to be contacted in case changes to the booking occur, e.g., in case of interruptions. Format according to E.164 The international public telecommunication numbering plan  
    #[serde(rename = "phoneNumber", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub phone_number: Option<Option<String>>,
    #[serde(rename = "address", skip_serializing_if = "Option::is_none")]
    pub address: Option<Box<models::Address>>,
    #[serde(rename = "postalAddress", skip_serializing_if = "Option::is_none")]
    pub postal_address: Option<Box<models::PostalAddress>>,
    #[serde(rename = "contact", skip_serializing_if = "Option::is_none")]
    pub contact: Option<Box<models::ContactDetail>>,
    /// Tax identification of the physical person for issuing an invoice or receipt
    #[serde(rename = "taxId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub tax_id: Option<Option<String>>,
}

impl PersonDetail {
    /// Personal information potentially needed at booking step. To support privacy by design, it is not permitted to send personal information not required to create a valid booking. Note that address is deprecated in favor of `postalAddress`, and email and phoneNumber  are deprecated in favor of the attributes in `ContactDetail` 
    pub fn new(first_name: String, last_name: String) -> PersonDetail {
        PersonDetail {
            preferred_language: None,
            summary: None,
            first_name,
            last_name,
            first_family_name: None,
            second_family_name: None,
            email: None,
            phone_number: None,
            address: None,
            postal_address: None,
            contact: None,
            tax_id: None,
        }
    }
}