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

/// ReservationOfferPart : Reservation includes the reference to the in the initial offer. The offer needs to be updated with the selected places before the confirmation which creates the reservation details including the reserved places. 
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct ReservationOfferPart {
    /// Attribute is used as discriminator for inheritance between data types.
    #[serde(rename = "objectType")]
    pub object_type: String,
    #[serde(rename = "id")]
    pub id: String,
    /// A human-readable description of the Offer. 
    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub summary: Option<Option<String>>,
    #[serde(rename = "createdOn")]
    pub created_on: String,
    /// Time from which on the offer can be used, e.g. travel. 
    #[serde(rename = "validFrom")]
    pub valid_from: String,
    /// Time until the offer can be used, e.g. travel. 
    #[serde(rename = "validUntil", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub valid_until: Option<Option<String>>,
    #[serde(rename = "price")]
    pub price: Box<models::Price>,
    #[serde(rename = "tripCoverage", skip_serializing_if = "Option::is_none")]
    pub trip_coverage: Option<Box<models::TripCoverage>>,
    #[serde(rename = "inboundTripCoverage", skip_serializing_if = "Option::is_none")]
    pub inbound_trip_coverage: Option<Box<models::TripCoverage>>,
    /// Indicates until when the price for the given offer is guaranteed. 
    #[serde(rename = "priceGuaranteedUntil", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub price_guaranteed_until: Option<Option<String>>,
    #[serde(rename = "offerMode")]
    pub offer_mode: models::OfferMode,
    /// Indicates whether the offerId can be used in more than one booking. 
    #[serde(rename = "isReusable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub is_reusable: Option<Option<bool>>,
    #[serde(rename = "passengerRefs")]
    pub passenger_refs: Vec<String>,
    /// Total amount of items of this type currently available. For reservation offers, this would be the total number of seats available, regardless of their properties. 
    #[serde(rename = "numericAvailability", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub numeric_availability: Option<Option<i32>>,
    #[serde(rename = "refundable")]
    pub refundable: models::RefundType,
    #[serde(rename = "exchangeable")]
    pub exchangeable: models::ExchangeableType,
    #[serde(rename = "afterSalesConditions", skip_serializing_if = "Option::is_none")]
    pub after_sales_conditions: Option<Vec<models::AfterSaleCondition>>,
    /// List of tags (and their type) that allow identifying sets of compatible offers when trying to combine multiple offers covering one single trip. At least one (not all) tripTags must be in common to allow combination If no tag is provided, there is no trip constraint on this specific offer. 
    #[serde(rename = "tripTags", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub trip_tags: Option<Option<Vec<String>>>,
    /// List of tags (and their type) that allow identifying sets of compatible offers when booking a return trip involving return-specific fares. All returnTags must be present in the counterpart offer to allow combination If no tag is provided, there is no return constraint on this specific offer. 
    #[serde(rename = "returnTags", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub return_tags: Option<Option<Vec<String>>>,
    #[serde(rename = "offerTag", skip_serializing_if = "Option::is_none")]
    pub offer_tag: Option<Box<models::OfferTag>>,
    /// Boolean-expression indicating the data that must be set in the data model in order to proceed to next step of the process.   The syntax and semantics of the expression is described in detail in the OSDM documentation. 
    #[serde(rename = "requestedInformation", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub requested_information: Option<Option<String>>,
    /// Id of the product representing the commercial attributes of this offer part. Although not currently mandatory, this attribute should in all cases be facilitate product based processing at the client
    #[serde(rename = "summaryProductId", skip_serializing_if = "Option::is_none")]
    pub summary_product_id: Option<String>,
    #[serde(rename = "products")]
    pub products: Vec<models::ProductLegAssociation>,
    #[serde(rename = "availableFulfillmentOptions")]
    pub available_fulfillment_options: Vec<models::FulfillmentOption>,
    #[serde(rename = "appliedCorporateCodes", skip_serializing_if = "Option::is_none")]
    pub applied_corporate_codes: Option<Vec<models::CorporateCode>>,
    #[serde(rename = "appliedPassengerTypes", skip_serializing_if = "Option::is_none")]
    pub applied_passenger_types: Option<Vec<models::AppliedPassengerType>>,
    #[serde(rename = "appliedPromotionCodes", skip_serializing_if = "Option::is_none")]
    pub applied_promotion_codes: Option<Vec<models::PromotionCode>>,
    #[serde(rename = "appliedReductionCardTypes", skip_serializing_if = "Option::is_none")]
    pub applied_reduction_card_types: Option<Vec<models::ReductionCardType>>,
    #[serde(rename = "regionalValiditySummary", skip_serializing_if = "Option::is_none")]
    pub regional_validity_summary: Option<Box<models::RegionalValiditySummary>>,
    #[serde(rename = "indicatedConsumption", skip_serializing_if = "Option::is_none")]
    pub indicated_consumption: Option<Box<models::IndicatedConsumption>>,
    #[serde(rename = "grantedReductionAmounts", skip_serializing_if = "Option::is_none")]
    pub granted_reduction_amounts: Option<Box<models::GrantedReductionAmounts>>,
    /// Java Property Name: 'links' 
    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
    pub _links: Option<Vec<models::Link>>,
    /// *DEPRECATED* Formerly OSDM allowed to link ancillaries to reservation. Since 3.7.0, it is recommended to only link reservations to admissions, ancillaries, and not the other way round. Referrence will be removed in 4.0.0 
    #[serde(rename = "ancillaries", skip_serializing_if = "Option::is_none")]
    pub ancillaries: Option<Vec<models::AncillaryRelation>>,
    #[serde(rename = "availablePlaces", skip_serializing_if = "Option::is_none")]
    pub available_places: Option<Vec<models::AvailablePlace>>,
    #[serde(rename = "availablePlacePreferences", skip_serializing_if = "Option::is_none")]
    pub available_place_preferences: Option<Vec<models::AvailablePlacePreferences>>,
    #[serde(rename = "feeRefs", skip_serializing_if = "Option::is_none")]
    pub fee_refs: Option<Vec<models::OfferPartReference>>,
    #[serde(rename = "numberOfPrivateCompartments", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub number_of_private_compartments: Option<Option<i32>>,
    /// Supported place selection flows might depend on available places. 
    #[serde(rename = "supportedPlaceSelectionFlows", skip_serializing_if = "Option::is_none")]
    pub supported_place_selection_flows: Option<Vec<String>>,
}

impl ReservationOfferPart {
    /// Reservation includes the reference to the in the initial offer. The offer needs to be updated with the selected places before the confirmation which creates the reservation details including the reserved places. 
    pub fn new(object_type: String, id: String, created_on: String, valid_from: String, price: models::Price, offer_mode: models::OfferMode, passenger_refs: Vec<String>, refundable: models::RefundType, exchangeable: models::ExchangeableType, products: Vec<models::ProductLegAssociation>, available_fulfillment_options: Vec<models::FulfillmentOption>) -> ReservationOfferPart {
        ReservationOfferPart {
            object_type,
            id,
            summary: None,
            created_on,
            valid_from,
            valid_until: None,
            price: Box::new(price),
            trip_coverage: None,
            inbound_trip_coverage: None,
            price_guaranteed_until: None,
            offer_mode,
            is_reusable: None,
            passenger_refs,
            numeric_availability: None,
            refundable,
            exchangeable,
            after_sales_conditions: None,
            trip_tags: None,
            return_tags: None,
            offer_tag: None,
            requested_information: None,
            summary_product_id: None,
            products,
            available_fulfillment_options,
            applied_corporate_codes: None,
            applied_passenger_types: None,
            applied_promotion_codes: None,
            applied_reduction_card_types: None,
            regional_validity_summary: None,
            indicated_consumption: None,
            granted_reduction_amounts: None,
            _links: None,
            ancillaries: None,
            available_places: None,
            available_place_preferences: None,
            fee_refs: None,
            number_of_private_compartments: None,
            supported_place_selection_flows: None,
        }
    }
}