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

/// ContinuousServiceBookingPart : A booking part for a continuous on-demand service. 
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct ContinuousServiceBookingPart {
    /// 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>>,
    /// List of pick-up places for on-demand vehicles. The list might include more or other pick up places than mentioned originally in the trip specification. 
    #[serde(rename = "pickUpPlaces")]
    pub pick_up_places: Vec<models::ContinuousServicePickUpPlace>,
    /// id of the tip for staff (e.g. taxi)
    #[serde(rename = "tipRef", skip_serializing_if = "Option::is_none")]
    pub tip_ref: Option<String>,
}

impl ContinuousServiceBookingPart {
    /// A booking part for a continuous on-demand service. 
    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, pick_up_places: Vec<models::ContinuousServicePickUpPlace>) -> ContinuousServiceBookingPart {
        ContinuousServiceBookingPart {
            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,
            pick_up_places,
            tip_ref: None,
        }
    }
}