osdm_sys/models/
fulfillment_document.rs

1/*
2 * UIC 90918-10 - OSDM
3 *
4 * 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/) 
5 *
6 * The version of the OpenAPI document: 3.7.0
7 * Contact: osdm@uic.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14use serde_with::serde_as;
15
16/// FulfillmentDocument : Document created for fulfillment. Either downloadLink + downloadExpiry or content must be provided. 
17#[serde_as]
18#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
19pub struct FulfillmentDocument {
20    /// Fulfillment types. RCT2, RCCST and UIC_PDF are official UIC standards. Notice:`ALLOCATOR_APP` is deprecated and should not be used anymore. The `ALLOCATOR_APP` type is replaced by the `RETAILER_APP` type. `DISTRIBUTOR_APP` was introduced to distinguish between the different types of apps that can be used to fulfill a booking. Values from the [Fulfillment Media Type Code List](https://osdm.io/spec/catalog-of-code-lists/#FulfillmentMediaType) Listed values here are examples. 
21    #[serde(rename = "medium")]
22    pub medium: String,
23    /// The type of fulfillment document. Values from the [Fulfillment Document Type Code List](https://osdm.io/spec/catalog-of-code-lists/#FulfillmentDocumentType) 
24    #[serde(rename = "type")]
25    pub r#type: String,
26    #[serde(rename = "downloadLink", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub download_link: Option<Option<String>>,
28    /// Expiration time of the download link, the document will not be available at the given URI after this time. 
29    #[serde(rename = "downloadExpiry", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub download_expiry: Option<Option<String>>,
31    /// base64 encoded binary of the actual fulfillment document. The length restriction of 4 MBytes applies to the encoded string, so the raw document cannot exceed 3 MBytes in size. 
32    #[serde_as(as = "super::DoubleOption<serde_with::base64::Base64>")]
33    #[serde(rename = "content", default, skip_serializing_if = "Option::is_none")]
34    pub content: Option<Option<Vec<u8>>>,
35    #[serde(rename = "format")]
36    pub format: models::DocumentFormat,
37    /// Identifies a company. For rail, a RICS company code or compatible ERA company code are used.  E.g.: 'urn:uic:rics:1185:000011' 
38    #[serde(rename = "applicationProvider", skip_serializing_if = "Option::is_none")]
39    pub application_provider: Option<String>,
40}
41
42impl FulfillmentDocument {
43    /// Document created for fulfillment. Either downloadLink + downloadExpiry or content must be provided. 
44    pub fn new(medium: String, r#type: String, format: models::DocumentFormat) -> FulfillmentDocument {
45        FulfillmentDocument {
46            medium,
47            r#type,
48            download_link: None,
49            download_expiry: None,
50            content: None,
51            format,
52            application_provider: None,
53        }
54    }
55}
56