zernio 0.0.444

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.4
 * 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 Metronome's 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 Metronome 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>>,
}

impl UsageMetering {
    /// Billed spend by product family over a window, from Metronome's 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,
        }
    }
}
///
#[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
    }
}