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

/// BookingSearchResult : Summary of the booking found by the booking search. For more information, get the booking. 
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct BookingSearchResult {
    #[serde(rename = "purchaser", skip_serializing_if = "Option::is_none")]
    pub purchaser: Option<Box<models::Purchaser>>,
    #[serde(rename = "passengers")]
    pub passengers: Vec<models::Passenger>,
    #[serde(rename = "tripSummaries", skip_serializing_if = "Option::is_none")]
    pub trip_summaries: Option<Vec<models::TripSummary>>,
    #[serde(rename = "id")]
    pub id: String,
    /// The unique booking code in the provider system. Usually refers to an order number or PNR.
    #[serde(rename = "bookingCode", skip_serializing_if = "Option::is_none")]
    pub booking_code: Option<String>,
    /// The unique booking reference in the provider system. Usually refers to an order number or PNR. 
    #[serde(rename = "externalRef", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub external_ref: Option<Option<String>>,
    #[serde(rename = "provisionalPrice", skip_serializing_if = "Option::is_none")]
    pub provisional_price: Option<Box<models::Price>>,
    #[serde(rename = "provisionalRefundAmount", skip_serializing_if = "Option::is_none")]
    pub provisional_refund_amount: Option<Box<models::Price>>,
    #[serde(rename = "confirmedPrice", skip_serializing_if = "Option::is_none")]
    pub confirmed_price: Option<Box<models::Price>>,
    #[serde(rename = "bookedOfferSummaries")]
    pub booked_offer_summaries: Vec<models::BookedOfferSummary>,
}

impl BookingSearchResult {
    /// Summary of the booking found by the booking search. For more information, get the booking. 
    pub fn new(passengers: Vec<models::Passenger>, id: String, booked_offer_summaries: Vec<models::BookedOfferSummary>) -> BookingSearchResult {
        BookingSearchResult {
            purchaser: None,
            passengers,
            trip_summaries: None,
            id,
            booking_code: None,
            external_ref: None,
            provisional_price: None,
            provisional_refund_amount: None,
            confirmed_price: None,
            booked_offer_summaries,
        }
    }
}