late 0.0.1302

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.433.2
 * 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 TreasuryTopup {
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(rename = "method", skip_serializing_if = "Option::is_none")]
    pub method: Option<Method>,
    /// `balance` funds your balance; `payout_batch` is the card payment of one payout batch, which pays its creators directly.
    #[serde(rename = "purpose", skip_serializing_if = "Option::is_none")]
    pub purpose: Option<Purpose>,
    #[serde(rename = "payoutBatch", skip_serializing_if = "Option::is_none")]
    pub payout_batch: Option<Box<models::TreasuryTopupPayoutBatch>>,
    /// True for a `payout_batch` payment: Zernio pays the Stripe processing fee out of its transfer fee, so you are credited the whole charge.
    #[serde(rename = "feeCoveredByZernio", skip_serializing_if = "Option::is_none")]
    pub fee_covered_by_zernio: Option<bool>,
    /// Gross amount charged
    #[serde(rename = "amountCents", skip_serializing_if = "Option::is_none")]
    pub amount_cents: Option<i32>,
    /// Stripe processing fee you paid; null until Stripe reports it, 0 when Zernio covers it
    #[serde(
        rename = "stripeFeeCents",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub stripe_fee_cents: Option<Option<i32>>,
    /// Amount credited to your balance: gross minus the Stripe fee, or the whole charge when Zernio covers the fee; null until Stripe reports it
    #[serde(
        rename = "netCents",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub net_cents: Option<Option<i32>>,
    /// `pending` until the card is charged (or 3D Secure is finished) and credited. `expired` means it ended unpaid: cancelled, or 3D Secure left unfinished for 30 minutes. Only `pending` counts toward pendingTopupCents.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
    #[serde(
        rename = "succeededAt",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub succeeded_at: Option<Option<String>>,
}

impl TreasuryTopup {
    pub fn new() -> TreasuryTopup {
        TreasuryTopup {
            id: None,
            method: None,
            purpose: None,
            payout_batch: None,
            fee_covered_by_zernio: None,
            amount_cents: None,
            stripe_fee_cents: None,
            net_cents: None,
            status: None,
            created_at: None,
            succeeded_at: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Method {
    #[serde(rename = "card")]
    Card,
    #[serde(rename = "bank_transfer")]
    BankTransfer,
}

impl Default for Method {
    fn default() -> Method {
        Self::Card
    }
}
/// `balance` funds your balance; `payout_batch` is the card payment of one payout batch, which pays its creators directly.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Purpose {
    #[serde(rename = "balance")]
    Balance,
    #[serde(rename = "payout_batch")]
    PayoutBatch,
}

impl Default for Purpose {
    fn default() -> Purpose {
        Self::Balance
    }
}
/// `pending` until the card is charged (or 3D Secure is finished) and credited. `expired` means it ended unpaid: cancelled, or 3D Secure left unfinished for 30 minutes. Only `pending` counts toward pendingTopupCents.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "pending")]
    Pending,
    #[serde(rename = "succeeded")]
    Succeeded,
    #[serde(rename = "failed")]
    Failed,
    #[serde(rename = "expired")]
    Expired,
}

impl Default for Status {
    fn default() -> Status {
        Self::Pending
    }
}