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

/// Reservation : 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 Reservation {
    /// Attribute is used as discriminator for inheritance between data types.
    #[serde(rename = "objectType")]
    pub object_type: String,
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub summary: Option<Option<String>>,
    /// Validity of offer towards passenger 
    #[serde(rename = "createdOn")]
    pub created_on: String,
    /// confirmationTimeLimit in booking should be used. Date until the booking part needs to be confirmed. Must be provided for a booking part in PREBOOKED stated. For later states, the value is ignored and can be null. 
    #[serde(rename = "confirmableUntil", skip_serializing_if = "Option::is_none")]
    pub confirmable_until: Option<String>,
    #[serde(rename = "validFrom")]
    pub valid_from: String,
    /// Validity of offer towards passenger 
    #[serde(rename = "validUntil", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub valid_until: Option<Option<String>>,
    #[serde(rename = "confirmedOn", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub confirmed_on: Option<Option<String>>,
    #[serde(rename = "confirmedFulfillmentOptions", skip_serializing_if = "Option::is_none")]
    pub confirmed_fulfillment_options: Option<Box<models::FulfillmentOption>>,
    #[serde(rename = "price")]
    pub price: Box<models::Price>,
    #[serde(rename = "refundAmount", skip_serializing_if = "Option::is_none")]
    pub refund_amount: Option<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>>,
    /// Id of the product representing the commercial attributes of this booking part. Although not currently mandatory, this attribute should in all cases be filled in order to allow matching a booking response to the data in the booking request 
    #[serde(rename = "summaryProductId", skip_serializing_if = "Option::is_none")]
    pub summary_product_id: Option<String>,
    /// In offer mode, in almost all cases exactly one product is referenced. Only on some French trips consisting of a TGV and a TER two products need to be used. In fare mode, no product exists as first needs to created from the different fares. 
    #[serde(rename = "products", skip_serializing_if = "Option::is_none")]
    pub products: Option<Vec<models::ProductLegAssociation>>,
    #[serde(rename = "status")]
    pub status: models::BookingPartStatus,
    /// payment status in post-payment scenarios
    #[serde(rename = "pricingStatus", skip_serializing_if = "Option::is_none")]
    pub pricing_status: Option<String>,
    #[serde(rename = "offerMode", skip_serializing_if = "Option::is_none")]
    pub offer_mode: Option<models::OfferMode>,
    /// The unique booking code for the part in the provider system. 
    #[serde(rename = "bookingPartCode", skip_serializing_if = "Option::is_none")]
    pub booking_part_code: Option<String>,
    /// reference to the booking in the downstream distributor system 
    #[serde(rename = "distributorBookingRef", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub distributor_booking_ref: Option<Option<String>>,
    /// reference to the booking in the downstream distributor system 
    #[serde(rename = "retailerBookingRef", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub retailer_booking_ref: Option<Option<String>>,
    /// Id of the passenger 
    #[serde(rename = "passengerIds")]
    pub passenger_ids: Vec<String>,
    #[serde(rename = "availableFulfillmentOptions", skip_serializing_if = "Option::is_none")]
    pub available_fulfillment_options: Option<Vec<models::FulfillmentOption>>,
    #[serde(rename = "refundable")]
    pub refundable: models::RefundType,
    #[serde(rename = "exchangeable")]
    pub exchangeable: models::ExchangeableType,
    /// Fine grained specification of the after sale condition of the booking. 
    #[serde(rename = "afterSaleConditions", skip_serializing_if = "Option::is_none")]
    pub after_sale_conditions: Option<Vec<models::AfterSaleCondition>>,
    #[serde(rename = "afterSalesOverrideDetails", skip_serializing_if = "Option::is_none")]
    pub after_sales_override_details: Option<Box<models::AfterSalesOverrideDetails>>,
    #[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 = "appliedReductions", skip_serializing_if = "Option::is_none")]
    pub applied_reductions: Option<Vec<models::CardReference>>,
    #[serde(rename = "indicatedConsumption", skip_serializing_if = "Option::is_none")]
    pub indicated_consumption: Option<Box<models::IndicatedConsumption>>,
    #[serde(rename = "accountingRef", skip_serializing_if = "Option::is_none")]
    pub accounting_ref: Option<Box<models::AccountingRef>>,
    #[serde(rename = "grantedReductionAmounts", skip_serializing_if = "Option::is_none")]
    pub granted_reduction_amounts: Option<Box<models::GrantedReductionAmounts>>,
    #[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<Box<models::PlaceAllocation>>,
    #[serde(rename = "feeRefs", skip_serializing_if = "Option::is_none")]
    pub fee_refs: Option<Vec<models::BookingPartReference>>,
    /// *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 = "ancillaryRefs", skip_serializing_if = "Option::is_none")]
    pub ancillary_refs: Option<Vec<models::BookingPartReference>>,
    /// options for place selection in case the place selection is made after the pre-booking.
    #[serde(rename = "availablePlacePreferences", skip_serializing_if = "Option::is_none")]
    pub available_place_preferences: Option<Vec<models::AvailablePlacePreferences>>,
    /// more detailed information on options for place selection and possible fees are part of availablePlacePreferences
    #[serde(rename = "graphicalReservationSupported", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub graphical_reservation_supported: Option<Option<bool>>,
    /// 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 Reservation {
    /// 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, status: models::BookingPartStatus, passenger_ids: Vec<String>, refundable: models::RefundType, exchangeable: models::ExchangeableType) -> Reservation {
        Reservation {
            object_type,
            id,
            summary: None,
            created_on,
            confirmable_until: None,
            valid_from,
            valid_until: None,
            confirmed_on: None,
            confirmed_fulfillment_options: None,
            price: Box::new(price),
            refund_amount: None,
            trip_coverage: None,
            inbound_trip_coverage: None,
            summary_product_id: None,
            products: None,
            status,
            pricing_status: None,
            offer_mode: None,
            booking_part_code: None,
            distributor_booking_ref: None,
            retailer_booking_ref: None,
            passenger_ids,
            available_fulfillment_options: None,
            refundable,
            exchangeable,
            after_sale_conditions: None,
            after_sales_override_details: None,
            applied_corporate_codes: None,
            applied_passenger_types: None,
            applied_promotion_codes: None,
            applied_reductions: None,
            indicated_consumption: None,
            accounting_ref: None,
            granted_reduction_amounts: None,
            place_selection: None,
            place_allocation: None,
            fee_refs: None,
            ancillary_refs: None,
            available_place_preferences: None,
            graphical_reservation_supported: None,
            supported_place_selection_flows: None,
        }
    }
}