Skip to main content

fattureincloud_rs/models/
received_document.rs

1/*
2 * Fatture in Cloud API v2 - API Reference
3 *
4 * Connect your software with Fatture in Cloud, the invoicing platform chosen by more than 500.000 businesses in Italy.   The Fatture in Cloud API is based on REST, and makes possible to interact with the user related data prior authorization via OAuth2 protocol.
5 *
6 * The version of the OpenAPI document: 2.0.32
7 * Contact: info@fattureincloud.it
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12
13#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
14pub struct ReceivedDocument {
15    /// Received document id
16    #[serde(rename = "id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
17    pub id: Option<Option<i32>>,
18    /// Received document type
19    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
20    pub r#type: Option<Type>,
21    #[serde(rename = "entity", skip_serializing_if = "Option::is_none")]
22    pub entity: Option<Box<models::Entity>>,
23    /// Received document date [defaults to today's date]
24    #[serde(rename = "date", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub date: Option<Option<String>>,
26    /// Received document category
27    #[serde(rename = "category", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub category: Option<Option<String>>,
29    /// Received document description
30    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub description: Option<Option<String>>,
32    /// Received document total net amount
33    #[serde(rename = "amount_net", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub amount_net: Option<Option<f64>>,
35    /// Received document total vat amount
36    #[serde(rename = "amount_vat", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37    pub amount_vat: Option<Option<f64>>,
38    /// Received document withholding tax amount
39    #[serde(rename = "amount_withholding_tax", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
40    pub amount_withholding_tax: Option<Option<f64>>,
41    /// Received document other withholding tax amount
42    #[serde(rename = "amount_other_withholding_tax", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
43    pub amount_other_withholding_tax: Option<Option<f64>>,
44    /// [Read Only] Received document total gross amount
45    #[serde(rename = "amount_gross", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
46    pub amount_gross: Option<Option<f64>>,
47    /// Received document amortization value
48    #[serde(rename = "amortization", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49    pub amortization: Option<Option<f64>>,
50    /// Received document revenue center
51    #[serde(rename = "rc_center", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
52    pub rc_center: Option<Option<String>>,
53    /// Received document invoice number
54    #[serde(rename = "invoice_number", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
55    pub invoice_number: Option<Option<String>>,
56    /// Received document is marked
57    #[serde(rename = "is_marked", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
58    pub is_marked: Option<Option<bool>>,
59    /// Received document has items
60    #[serde(rename = "is_detailed", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
61    pub is_detailed: Option<Option<bool>>,
62    /// [Read Only] Received document is an e-invoice
63    #[serde(rename = "e_invoice", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
64    pub e_invoice: Option<Option<bool>>,
65    /// [Read Only] Received document date of the next not paid payment
66    #[serde(rename = "next_due_date", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
67    pub next_due_date: Option<Option<String>>,
68    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
69    pub currency: Option<Box<models::Currency>>,
70    /// Received document tax deducibility percentage
71    #[serde(rename = "tax_deductibility", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
72    pub tax_deductibility: Option<Option<f64>>,
73    /// Received document vat deducibility percentage
74    #[serde(rename = "vat_deductibility", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
75    pub vat_deductibility: Option<Option<f64>>,
76    #[serde(rename = "items_list", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
77    pub items_list: Option<Option<Vec<models::ReceivedDocumentItemsListItem>>>,
78    #[serde(rename = "payments_list", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
79    pub payments_list: Option<Option<Vec<models::ReceivedDocumentPaymentsListItem>>>,
80    /// [Temporary] [Read Only] Received document url of the attached file
81    #[serde(rename = "attachment_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
82    pub attachment_url: Option<Option<String>>,
83    /// [Temporary] [Read Only] Received document url of the attachment preview
84    #[serde(rename = "attachment_preview_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
85    pub attachment_preview_url: Option<Option<String>>,
86    /// Received document total items amount and total payments amount can differ if this field is set to false
87    #[serde(rename = "auto_calculate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
88    pub auto_calculate: Option<Option<bool>>,
89    /// [Write Only] Received document attachment token returned by POST /received_documents/attachment
90    #[serde(rename = "attachment_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
91    pub attachment_token: Option<Option<String>>,
92    /// Received Document can't be edited
93    #[serde(rename = "locked", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
94    pub locked: Option<Option<bool>>,
95    /// Received document creation date
96    #[serde(rename = "created_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
97    pub created_at: Option<Option<String>>,
98    /// Received document last update date
99    #[serde(rename = "updated_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
100    pub updated_at: Option<Option<String>>,
101}
102
103impl ReceivedDocument {
104    pub fn new() -> ReceivedDocument {
105        ReceivedDocument {
106            id: None,
107            r#type: None,
108            entity: None,
109            date: None,
110            category: None,
111            description: None,
112            amount_net: None,
113            amount_vat: None,
114            amount_withholding_tax: None,
115            amount_other_withholding_tax: None,
116            amount_gross: None,
117            amortization: None,
118            rc_center: None,
119            invoice_number: None,
120            is_marked: None,
121            is_detailed: None,
122            e_invoice: None,
123            next_due_date: None,
124            currency: None,
125            tax_deductibility: None,
126            vat_deductibility: None,
127            items_list: None,
128            payments_list: None,
129            attachment_url: None,
130            attachment_preview_url: None,
131            auto_calculate: None,
132            attachment_token: None,
133            locked: None,
134            created_at: None,
135            updated_at: None,
136        }
137    }
138}
139/// Received document type
140#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
141pub enum Type {
142    #[serde(rename = "expense")]
143    Expense,
144    #[serde(rename = "passive_credit_note")]
145    PassiveCreditNote,
146    #[serde(rename = "passive_delivery_note")]
147    PassiveDeliveryNote,
148}
149
150impl Default for Type {
151    fn default() -> Type {
152        Self::Expense
153    }
154}
155