late 0.0.1291

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.416.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 PayoutBatch {
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "campaignId", deserialize_with = "Option::deserialize")]
    pub campaign_id: Option<String>,
    /// `awaiting_payment` until the card charge succeeds (3D Secure included); `paying` while transfers go out; then `paid`, `partially_failed` (some items failed or were skipped), `failed` (the card was declined, or none paid) or `expired` (the payment was cancelled unpaid, every amount is payable again).
    #[serde(rename = "status")]
    pub status: Status,
    #[serde(rename = "method")]
    pub method: Method,
    /// Total the creators receive.
    #[serde(rename = "amountCents")]
    pub amount_cents: i32,
    /// Total Zernio fee.
    #[serde(rename = "feeCents")]
    pub fee_cents: i32,
    /// The card charge: amountCents plus feeCents.
    #[serde(rename = "totalCents")]
    pub total_cents: i32,
    #[serde(rename = "items")]
    pub items: Vec<models::PayoutBatchItem>,
    #[serde(rename = "paidAt", deserialize_with = "Option::deserialize")]
    pub paid_at: Option<String>,
    #[serde(rename = "finishedAt", deserialize_with = "Option::deserialize")]
    pub finished_at: Option<String>,
    #[serde(rename = "createdAt")]
    pub created_at: String,
}

impl PayoutBatch {
    pub fn new(
        id: String,
        campaign_id: Option<String>,
        status: Status,
        method: Method,
        amount_cents: i32,
        fee_cents: i32,
        total_cents: i32,
        items: Vec<models::PayoutBatchItem>,
        paid_at: Option<String>,
        finished_at: Option<String>,
        created_at: String,
    ) -> PayoutBatch {
        PayoutBatch {
            id,
            campaign_id,
            status,
            method,
            amount_cents,
            fee_cents,
            total_cents,
            items,
            paid_at,
            finished_at,
            created_at,
        }
    }
}
/// `awaiting_payment` until the card charge succeeds (3D Secure included); `paying` while transfers go out; then `paid`, `partially_failed` (some items failed or were skipped), `failed` (the card was declined, or none paid) or `expired` (the payment was cancelled unpaid, every amount is payable again).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "awaiting_payment")]
    AwaitingPayment,
    #[serde(rename = "paying")]
    Paying,
    #[serde(rename = "paid")]
    Paid,
    #[serde(rename = "partially_failed")]
    PartiallyFailed,
    #[serde(rename = "failed")]
    Failed,
    #[serde(rename = "expired")]
    Expired,
}

impl Default for Status {
    fn default() -> Status {
        Self::AwaitingPayment
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Method {
    #[serde(rename = "card")]
    Card,
}

impl Default for Method {
    fn default() -> Method {
        Self::Card
    }
}