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

/// AdmissionOfferPart : An admission represents a travel right, or the entitlement to travel onboard a train between the given origin and destination, following the given route. It does not include a seat reservation. 
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct AdmissionOfferPart {
    /// 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>>,
    #[serde(rename = "regionalValidity", skip_serializing_if = "Option::is_none")]
    pub regional_validity: Option<Box<models::RegionalValidity>>,
    /// This contains multiple regional validities for this item and replaces the `regionalValidity` (deprecated) attribute.
    #[serde(rename = "regionalValidities", skip_serializing_if = "Option::is_none")]
    pub regional_validities: Option<Vec<models::RegionalValidity>>,
    #[serde(rename = "isReservationRequired", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub is_reservation_required: Option<Option<bool>>,
    #[serde(rename = "reservations", skip_serializing_if = "Option::is_none")]
    pub reservations: Option<Vec<models::ReservationRelation>>,
    #[serde(rename = "ancillaries", skip_serializing_if = "Option::is_none")]
    pub ancillaries: Option<Vec<models::AncillaryRelation>>,
    #[serde(rename = "feeRefs", skip_serializing_if = "Option::is_none")]
    pub fee_refs: Option<Vec<models::OfferPartReference>>,
    #[serde(rename = "regulatoryConditions", skip_serializing_if = "Option::is_none")]
    pub regulatory_conditions: Option<Vec<models::RegulatoryCondition>>,
    /// List with all `ReservationOfferPart` objects that are included in this admission offer part.  DEPRECATED and superseded by `ReservationRelation.isIncluded` attribute. 
    #[serde(rename = "includedReservations", skip_serializing_if = "Option::is_none")]
    pub included_reservations: Option<Vec<models::ReservationOfferPart>>,
    #[serde(rename = "throughTicketTags", skip_serializing_if = "Option::is_none")]
    pub through_ticket_tags: Option<Vec<String>>,
}

impl AdmissionOfferPart {
    /// An admission represents a travel right, or the entitlement to travel onboard a train between the given origin and destination, following the given route. It does not include a seat reservation. 
    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>) -> AdmissionOfferPart {
        AdmissionOfferPart {
            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,
            regional_validity: None,
            regional_validities: None,
            is_reservation_required: None,
            reservations: None,
            ancillaries: None,
            fee_refs: None,
            regulatory_conditions: None,
            included_reservations: None,
            through_ticket_tags: None,
        }
    }
}