bitwarden-api-api 3.0.0

Api bindings for the Bitwarden API.
Documentation
/*
 * Bitwarden Internal API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: latest
 *
 * Generated by: https://openapi-generator.tech
 */

use serde::{Deserialize, Serialize};

use crate::models;

/// BillingCustomerDiscount : Customer discount information from Stripe billing.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BillingCustomerDiscount {
    /// The Stripe coupon ID (e.g., \"cm3nHfO1\").
    #[serde(rename = "id", alias = "Id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// Whether the discount is a recurring/perpetual discount with no expiration date.  This
    /// property is true only when the discount has no end date, meaning it applies indefinitely to
    /// all future renewals. This is a product decision for Milestone 2 to only display perpetual
    /// discounts in the UI. Note: This does NOT indicate whether the discount is \"currently
    /// active\" in the billing sense. A discount with a future end date is functionally active and
    /// will be applied by Stripe, but this property will be false because it has an expiration
    /// date.
    #[serde(
        rename = "active",
        alias = "Active",
        skip_serializing_if = "Option::is_none"
    )]
    pub active: Option<bool>,
    /// Percentage discount applied to the subscription (e.g., 20.0 for 20% off). Null if this is
    /// an amount-based discount.
    #[serde(
        rename = "percentOff",
        alias = "PercentOff",
        skip_serializing_if = "Option::is_none"
    )]
    pub percent_off: Option<f64>,
    /// Fixed amount discount in USD (e.g., 14.00 for $14 off). Converted from Stripe's cent-based
    /// values (1400 cents → $14.00). Null if this is a percentage-based discount. Note: Stripe
    /// stores amounts in the smallest currency unit. This value is always in USD.
    #[serde(
        rename = "amountOff",
        alias = "AmountOff",
        skip_serializing_if = "Option::is_none"
    )]
    pub amount_off: Option<f64>,
    /// List of Stripe product IDs that this discount applies to (e.g., [\"prod_premium\",
    /// \"prod_families\"]).  Null: discount applies to all products with no restrictions
    /// (AppliesTo not specified in Stripe). Empty list: discount restricted to zero products (edge
    /// case - AppliesTo.Products = [] in Stripe). Non-empty list: discount applies only to the
    /// specified product IDs.
    #[serde(
        rename = "appliesTo",
        alias = "AppliesTo",
        skip_serializing_if = "Option::is_none"
    )]
    pub applies_to: Option<Vec<String>>,
}

impl BillingCustomerDiscount {
    /// Customer discount information from Stripe billing.
    pub fn new() -> BillingCustomerDiscount {
        BillingCustomerDiscount {
            id: None,
            active: None,
            percent_off: None,
            amount_off: None,
            applies_to: None,
        }
    }
}