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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct RefundOffer {
    /// id of the refund offer 
    #[serde(rename = "id")]
    pub id: String,
    /// A human-readable description of the refund 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,
    #[serde(rename = "validFrom")]
    pub valid_from: String,
    /// time until the offer can be used 
    #[serde(rename = "validUntil")]
    pub valid_until: 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 = "status")]
    pub status: models::RefundStatus,
    #[serde(rename = "reimbursementStatus", skip_serializing_if = "Option::is_none")]
    pub reimbursement_status: Option<models::ReimbursementStatus>,
    #[serde(rename = "reimbursementDateTime", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub reimbursement_date_time: Option<Option<String>>,
    /// Reason for and type of an after sale, code list in IRS 90918-10. The PRM_SUPPORT_UNAVAILABLE overrule code shall only be used by the UIC PRM ABT tool. Values from the [Overrule Codes Code List](https://osdm.io/spec/catalog-of-code-lists/#OverruleCode) Listed values here are examples.    - 'CONNECTION_BROKEN' - 'DEATH' - 'EQUIPMENT_FAILURE' - 'PAYMENT_FAILURE' - 'PRM_SUPPORT_UNAVAILABLE' - 'SALES_STAFF_ERROR' - 'STOP_NOT_SERVED' - 'STRIKE' - 'TECHNICAL_FAILURE' - 'TICKET_NOT_USED' - 'INABILITY_TO_TRAVEL': Inability to travel due to accident or sickness. - 'EXTERNAL_COMPENSATION': Offer has been compensated outside of the provider system in another way. - 'DISRUPTION': Inability to operate due to disruption. - 'JOURNEY_OBSOLETE': Due to external factors it's senseless to start the trip, thus the travel is obsolete. - 'CERTIFIED_MEDICAL_CONDITION': A medical certificate certifies that the passenger is unable to travel. - 'DELAY_COMPENSATION': Allows to override conditions in context of passenger rights regulation (PRR). 
    #[serde(rename = "appliedOverruleCode", skip_serializing_if = "Option::is_none")]
    pub applied_overrule_code: Option<String>,
    /// fulfillments to be refunded or replaced
    #[serde(rename = "fulfillments")]
    pub fulfillments: Vec<models::Fulfillment>,
    /// new fulfillments issued with this offer (only available after confirmation)
    #[serde(rename = "issuedFulfillments", skip_serializing_if = "Option::is_none")]
    pub issued_fulfillments: Option<Vec<models::Fulfillment>>,
    #[serde(rename = "issuedVouchers", skip_serializing_if = "Option::is_none")]
    pub issued_vouchers: Option<Vec<models::VoucherInformation>>,
    #[serde(rename = "refundFee")]
    pub refund_fee: Box<models::Price>,
    #[serde(rename = "accountingRef", skip_serializing_if = "Option::is_none")]
    pub accounting_ref: Option<Box<models::AccountingRef>>,
    #[serde(rename = "refundableAmount")]
    pub refundable_amount: Box<models::Price>,
    /// breakdown of the refund offer 
    #[serde(rename = "refundOfferBreakdown", skip_serializing_if = "Option::is_none")]
    pub refund_offer_breakdown: Option<Vec<models::RefundOfferBreakdownItem>>,
    #[serde(rename = "reimbursementMethod", skip_serializing_if = "Option::is_none")]
    pub reimbursement_method: Option<Box<models::ReimbursementMethod>>,
    /// Java Property Name: 'links' 
    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
    pub _links: Option<Vec<models::Link>>,
}

impl RefundOffer {
    pub fn new(id: String, created_on: String, valid_from: String, valid_until: String, status: models::RefundStatus, fulfillments: Vec<models::Fulfillment>, refund_fee: models::Price, refundable_amount: models::Price) -> RefundOffer {
        RefundOffer {
            id,
            summary: None,
            created_on,
            valid_from,
            valid_until,
            confirmed_on: None,
            status,
            reimbursement_status: None,
            reimbursement_date_time: None,
            applied_overrule_code: None,
            fulfillments,
            issued_fulfillments: None,
            issued_vouchers: None,
            refund_fee: Box::new(refund_fee),
            accounting_ref: None,
            refundable_amount: Box::new(refundable_amount),
            refund_offer_breakdown: None,
            reimbursement_method: None,
            _links: None,
        }
    }
}