osdm-sys 0.1.0-alpha.3

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

/// Fare : The online representation of a fare. In case the final product requires the indication of carriers it is obligatory to provide a  carrierConstraint in the fare directly that includes the list of all carriers in the  includedCarrier list. Whether the carrier must be indicated needs to be derived from the requested total route and the location of the sales points for international sales.  Whether the indication of carriers is obligatory is defined in the Convention concerning International Carriage by Rail (COTIF). 
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct Fare {
    /// id of the fare item to be included in accounting 
    #[serde(rename = "id")]
    pub id: String,
    /// Basic UIC fare types used in 90918-10, 90918-4, and 90918-9. Values from the [Fare Type Code List](https://osdm.io/spec/catalog-of-code-lists/#FareType) Listed values here are examples. 
    #[serde(rename = "type")]
    pub r#type: String,
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<Box<models::Text>>,
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<Box<models::Text>>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<models::BookingPartStatus>,
    /// allows specifying a price in multiple currencies 
    #[serde(rename = "prices")]
    pub prices: Vec<models::Price>,
    #[serde(rename = "regionalConstraint")]
    pub regional_constraint: Box<models::RegionalConstraint>,
    #[serde(rename = "serviceConstraint", skip_serializing_if = "Option::is_none")]
    pub service_constraint: Option<Box<models::ServiceConstraint>>,
    #[serde(rename = "carrierConstraint", skip_serializing_if = "Option::is_none")]
    pub carrier_constraint: Option<Box<models::CarrierConstraint>>,
    #[serde(rename = "regulatoryConditions", skip_serializing_if = "Option::is_none")]
    pub regulatory_conditions: Option<Vec<models::RegulatoryCondition>>,
    #[serde(rename = "serviceClass", skip_serializing_if = "Option::is_none")]
    pub service_class: Option<Box<models::ServiceClass>>,
    /// Traditional first and second class. 
    #[serde(rename = "travelClass")]
    pub travel_class: String,
    #[serde(rename = "afterSalesCondition")]
    pub after_sales_condition: Box<models::AfterSalesConditionsLink>,
    #[serde(rename = "combinationConstraint")]
    pub combination_constraint: Vec<models::FareCombinationModel>,
    #[serde(rename = "fulfillmentConstraint", skip_serializing_if = "Option::is_none")]
    pub fulfillment_constraint: Option<Box<models::FulfillmentConstraint>>,
    #[serde(rename = "travelValidityConstraint")]
    pub travel_validity_constraint: Box<models::TravelValidity>,
    #[serde(rename = "availablePlaces", skip_serializing_if = "Option::is_none")]
    pub available_places: Option<Vec<models::AvailablePlace>>,
    #[serde(rename = "placeSelection", skip_serializing_if = "Option::is_none")]
    pub place_selection: Option<Box<models::PlaceSelection>>,
    #[serde(rename = "placeAllocation", skip_serializing_if = "Option::is_none")]
    pub place_allocation: Option<Vec<models::PlaceAllocation>>,
    #[serde(rename = "coveredSection", skip_serializing_if = "Option::is_none")]
    pub covered_section: Option<Box<models::Section>>,
    #[serde(rename = "passengerRefs", skip_serializing_if = "Option::is_none")]
    pub passenger_refs: Option<Vec<String>>,
    /// passenger constraint to be included in bar codes 
    #[serde(rename = "passengerConstraints", skip_serializing_if = "Option::is_none")]
    pub passenger_constraints: Option<Vec<models::PassengerConstraints>>,
    #[serde(rename = "involvedTCOs", skip_serializing_if = "Option::is_none")]
    pub involved_tcos: Option<Vec<String>>,
    #[serde(rename = "accountingRef", skip_serializing_if = "Option::is_none")]
    pub accounting_ref: Option<Box<models::AccountingRef>>,
    #[serde(rename = "legacyAccountingIdentifier", skip_serializing_if = "Option::is_none")]
    pub legacy_accounting_identifier: Option<Box<models::LegacyAccountingIdentifier>>,
    #[serde(rename = "legacyReservationParameter", skip_serializing_if = "Option::is_none")]
    pub legacy_reservation_parameter: Option<Box<models::LegacyReservationParameter>>,
    /// One of the listed cards is required to be valid at the time of travel. 
    #[serde(rename = "requiredCards", skip_serializing_if = "Option::is_none")]
    pub required_cards: Option<Vec<models::CardReference>>,
    #[serde(rename = "luggageConstraint", skip_serializing_if = "Option::is_none")]
    pub luggage_constraint: Option<Box<models::LuggageConstraint>>,
    #[serde(rename = "availablePreferences", skip_serializing_if = "Option::is_none")]
    pub available_preferences: Option<Vec<models::AvailablePlacePreferences>>,
}

impl Fare {
    /// The online representation of a fare. In case the final product requires the indication of carriers it is obligatory to provide a  carrierConstraint in the fare directly that includes the list of all carriers in the  includedCarrier list. Whether the carrier must be indicated needs to be derived from the requested total route and the location of the sales points for international sales.  Whether the indication of carriers is obligatory is defined in the Convention concerning International Carriage by Rail (COTIF). 
    pub fn new(id: String, r#type: String, prices: Vec<models::Price>, regional_constraint: models::RegionalConstraint, travel_class: String, after_sales_condition: models::AfterSalesConditionsLink, combination_constraint: Vec<models::FareCombinationModel>, travel_validity_constraint: models::TravelValidity) -> Fare {
        Fare {
            id,
            r#type,
            name: None,
            description: None,
            status: None,
            prices,
            regional_constraint: Box::new(regional_constraint),
            service_constraint: None,
            carrier_constraint: None,
            regulatory_conditions: None,
            service_class: None,
            travel_class,
            after_sales_condition: Box::new(after_sales_condition),
            combination_constraint,
            fulfillment_constraint: None,
            travel_validity_constraint: Box::new(travel_validity_constraint),
            available_places: None,
            place_selection: None,
            place_allocation: None,
            covered_section: None,
            passenger_refs: None,
            passenger_constraints: None,
            involved_tcos: None,
            accounting_ref: None,
            legacy_accounting_identifier: None,
            legacy_reservation_parameter: None,
            required_cards: None,
            luggage_constraint: None,
            available_preferences: None,
        }
    }
}