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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct Offer {
    #[serde(rename = "offerId")]
    pub offer_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 = "offerSummary", skip_serializing_if = "Option::is_none")]
    pub offer_summary: Option<Box<models::OfferSummary>>,
    #[serde(rename = "createdOn")]
    pub created_on: String,
    /// time until the offer can be pre-booked, however its availability is not guaranteed 
    #[serde(rename = "preBookableUntil")]
    pub pre_bookable_until: String,
    #[serde(rename = "passengerRefs")]
    pub passenger_refs: Vec<String>,
    #[serde(rename = "products", skip_serializing_if = "Option::is_none")]
    pub products: Option<Vec<models::Product>>,
    #[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>>,
    #[serde(rename = "admissionOfferParts", skip_serializing_if = "Option::is_none")]
    pub admission_offer_parts: Option<Vec<models::AdmissionOfferPart>>,
    #[serde(rename = "reservationOfferParts", skip_serializing_if = "Option::is_none")]
    pub reservation_offer_parts: Option<Vec<models::ReservationOfferPart>>,
    #[serde(rename = "ancillaryOfferParts", skip_serializing_if = "Option::is_none")]
    pub ancillary_offer_parts: Option<Vec<models::AncillaryOfferPart>>,
    #[serde(rename = "continuousServiceOfferParts", skip_serializing_if = "Option::is_none")]
    pub continuous_service_offer_parts: Option<Vec<models::ContinuousServiceOfferPart>>,
    #[serde(rename = "fees", skip_serializing_if = "Option::is_none")]
    pub fees: Option<Vec<models::Fee>>,
    #[serde(rename = "fares", skip_serializing_if = "Option::is_none")]
    pub fares: Option<Vec<models::Fare>>,
    ///  Java Property Name: 'links' 
    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
    pub _links: Option<Vec<models::Link>>,
}

impl Offer {
    pub fn new(offer_id: String, created_on: String, pre_bookable_until: String, passenger_refs: Vec<String>) -> Offer {
        Offer {
            offer_id,
            summary: None,
            offer_summary: None,
            created_on,
            pre_bookable_until,
            passenger_refs,
            products: None,
            trip_coverage: None,
            inbound_trip_coverage: None,
            admission_offer_parts: None,
            reservation_offer_parts: None,
            ancillary_offer_parts: None,
            continuous_service_offer_parts: None,
            fees: None,
            fares: None,
            _links: None,
        }
    }
}