Skip to main content

bitwarden_api_api/models/
invoice_preview_discount.rs

1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct InvoicePreviewDiscount {
17    #[serde(rename = "type", alias = "R#type")]
18    pub r#type: models::BitwardenDiscountType,
19    #[serde(rename = "value", alias = "Value")]
20    pub value: f64,
21    #[serde(rename = "amount", alias = "Amount")]
22    pub amount: f64,
23    #[serde(
24        rename = "label",
25        alias = "Label",
26        skip_serializing_if = "Option::is_none"
27    )]
28    pub label: Option<String>,
29    #[serde(
30        rename = "durationInMonths",
31        alias = "DurationInMonths",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub duration_in_months: Option<i64>,
35}
36
37impl InvoicePreviewDiscount {
38    pub fn new(
39        r#type: models::BitwardenDiscountType,
40        value: f64,
41        amount: f64,
42    ) -> InvoicePreviewDiscount {
43        InvoicePreviewDiscount {
44            r#type,
45            value,
46            amount,
47            label: None,
48            duration_in_months: None,
49        }
50    }
51}