late 0.0.1055

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api  Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal.  Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).  Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
 *
 * The version of the OpenAPI document: 1.104.0
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// UsageMetering : Billed spend by product family over a window, from the usage-based invoice breakdown (the CHARGE view). Returned by `GET /v1/usage`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct UsageMetering {
    /// False for legacy Stripe accounts (no usage-based invoice to split); `days` and `totals` are then empty/zero.
    #[serde(rename = "supported", skip_serializing_if = "Option::is_none")]
    pub supported: Option<bool>,
    #[serde(rename = "granularity", skip_serializing_if = "Option::is_none")]
    pub granularity: Option<Granularity>,
    /// One row per bucket. Empty when `granularity=total`. `date` is a UTC date (month buckets use the 1st).
    #[serde(rename = "days", skip_serializing_if = "Option::is_none")]
    pub days: Option<Vec<models::UsageMeteringDaysInner>>,
    #[serde(rename = "totals", skip_serializing_if = "Option::is_none")]
    pub totals: Option<Box<models::UsageMeteringTotals>>,
    /// Per-invoice-line-item rows (largest spend first) for a detailed breakdown.
    #[serde(rename = "lineItems", skip_serializing_if = "Option::is_none")]
    pub line_items: Option<Vec<models::UsageMeteringLineItemsInner>>,
    #[serde(rename = "peaks", skip_serializing_if = "Option::is_none")]
    pub peaks: Option<Box<models::UsageMeteringPeaks>>,
    #[serde(rename = "callUsage", skip_serializing_if = "Option::is_none")]
    pub call_usage: Option<Box<models::UsageMeteringCallUsage>>,
    #[serde(rename = "period", skip_serializing_if = "Option::is_none")]
    pub period: Option<Box<models::UsageMeteringPeriod>>,
    #[serde(rename = "tax", skip_serializing_if = "Option::is_none")]
    pub tax: Option<Box<models::UsageMeteringTax>>,
    #[serde(rename = "attribution", skip_serializing_if = "Option::is_none")]
    pub attribution: Option<Box<models::UsageMeteringAttribution>>,
    #[serde(rename = "scope", skip_serializing_if = "Option::is_none")]
    pub scope: Option<Box<models::UsageMeteringScope>>,
}

impl UsageMetering {
    /// Billed spend by product family over a window, from the usage-based invoice breakdown (the CHARGE view). Returned by `GET /v1/usage`.
    pub fn new() -> UsageMetering {
        UsageMetering {
            supported: None,
            granularity: None,
            days: None,
            totals: None,
            line_items: None,
            peaks: None,
            call_usage: None,
            period: None,
            tax: None,
            attribution: None,
            scope: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Granularity {
    #[serde(rename = "day")]
    Day,
    #[serde(rename = "month")]
    Month,
    #[serde(rename = "total")]
    Total,
}

impl Default for Granularity {
    fn default() -> Granularity {
        Self::Day
    }
}