late 0.0.1352

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.531.0
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadBalanceChargedTopup {
    /// The top-up id, as in GET /v1/balance (`recentTopups`) and its invoice and receipt endpoints.
    #[serde(rename = "id")]
    pub id: String,
    /// `manual`: someone added funds in Billing or through the API. `auto_top_up`: the auto top-up rule charged the card.
    #[serde(rename = "trigger")]
    pub trigger: Trigger,
    /// Added to the balance, in USD cents.
    #[serde(rename = "amountCents")]
    pub amount_cents: i32,
    /// VAT charged on top, in USD cents (0 when none applies).
    #[serde(rename = "taxCents")]
    pub tax_cents: i32,
    /// What the card was charged, in USD cents: amount plus tax.
    #[serde(rename = "chargedCents")]
    pub charged_cents: i32,
    #[serde(rename = "currency")]
    pub currency: Currency,
    #[serde(rename = "card")]
    pub card: Box<models::WebhookPayloadBalanceChargedTopupCard>,
}

impl WebhookPayloadBalanceChargedTopup {
    pub fn new(
        id: String,
        trigger: Trigger,
        amount_cents: i32,
        tax_cents: i32,
        charged_cents: i32,
        currency: Currency,
        card: models::WebhookPayloadBalanceChargedTopupCard,
    ) -> WebhookPayloadBalanceChargedTopup {
        WebhookPayloadBalanceChargedTopup {
            id,
            trigger,
            amount_cents,
            tax_cents,
            charged_cents,
            currency,
            card: Box::new(card),
        }
    }
}
/// `manual`: someone added funds in Billing or through the API. `auto_top_up`: the auto top-up rule charged the card.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Trigger {
    #[serde(rename = "manual")]
    Manual,
    #[serde(rename = "auto_top_up")]
    AutoTopUp,
}

impl Default for Trigger {
    fn default() -> Trigger {
        Self::Manual
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Currency {
    #[serde(rename = "usd")]
    Usd,
}

impl Default for Currency {
    fn default() -> Currency {
        Self::Usd
    }
}