late 0.0.1313

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

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

/// CommerceOrder : An order with what an invoice needs. Every amount is in `currency`, the store currency.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CommerceOrder {
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    #[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
    pub platform: Option<Platform>,
    /// The number the merchant and buyer see.
    #[serde(rename = "number", skip_serializing_if = "Option::is_none")]
    pub number: Option<String>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<models::CommerceOrderStatus>,
    /// Shopify fulfilment status (e.g. UNFULFILLED) or WooCommerce order status (e.g. processing).
    #[serde(rename = "platformStatus", skip_serializing_if = "Option::is_none")]
    pub platform_status: Option<String>,
    #[serde(
        rename = "paymentStatus",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub payment_status: Option<Option<PaymentStatus>>,
    /// Shopify financial status. Null on WooCommerce, where payment is read from the order status.
    #[serde(
        rename = "platformPaymentStatus",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub platform_payment_status: Option<Option<String>>,
    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
    pub currency: Option<String>,
    /// Whether line item and shipping amounts include tax. Always false on WooCommerce, whose API returns amounts before tax whatever the store displays (platformData.pricesIncludeTax).
    #[serde(rename = "taxesIncluded", skip_serializing_if = "Option::is_none")]
    pub taxes_included: Option<bool>,
    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
    #[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<String>,
    /// WooCommerce only; null on Shopify.
    #[serde(
        rename = "paidAt",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub paid_at: Option<Option<String>>,
    /// Shopify only; null on WooCommerce.
    #[serde(
        rename = "cancelledAt",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub cancelled_at: Option<Option<String>>,
    #[serde(
        rename = "cancelReason",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub cancel_reason: Option<Option<String>>,
    /// Line items before order discounts and shipping.
    #[serde(rename = "subtotal", skip_serializing_if = "Option::is_none")]
    pub subtotal: Option<Box<models::CommerceMoney>>,
    #[serde(rename = "discountTotal", skip_serializing_if = "Option::is_none")]
    pub discount_total: Option<Box<models::CommerceMoney>>,
    #[serde(rename = "shippingTotal", skip_serializing_if = "Option::is_none")]
    pub shipping_total: Option<Box<models::CommerceMoney>>,
    #[serde(rename = "taxTotal", skip_serializing_if = "Option::is_none")]
    pub tax_total: Option<Box<models::CommerceMoney>>,
    #[serde(rename = "total", skip_serializing_if = "Option::is_none")]
    pub total: Option<Box<models::CommerceMoney>>,
    #[serde(rename = "refundedTotal", skip_serializing_if = "Option::is_none")]
    pub refunded_total: Option<Box<models::CommerceMoney>>,
    #[serde(rename = "discountCodes", skip_serializing_if = "Option::is_none")]
    pub discount_codes: Option<Vec<String>>,
    #[serde(rename = "paymentMethods", skip_serializing_if = "Option::is_none")]
    pub payment_methods: Option<Vec<String>>,
    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
    pub customer: Option<Box<models::CommerceOrderCustomer>>,
    #[serde(
        rename = "billingAddress",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub billing_address: Option<Option<Box<models::CommerceAddress>>>,
    #[serde(
        rename = "shippingAddress",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub shipping_address: Option<Option<Box<models::CommerceAddress>>>,
    #[serde(
        rename = "buyerNote",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub buyer_note: Option<Option<String>>,
    #[serde(rename = "attribution", skip_serializing_if = "Option::is_none")]
    pub attribution: Option<Box<models::CommerceOrderAttribution>>,
    #[serde(rename = "lineItems", skip_serializing_if = "Option::is_none")]
    pub line_items: Option<Vec<models::CommerceOrderLineItemsInner>>,
    #[serde(rename = "shippingLines", skip_serializing_if = "Option::is_none")]
    pub shipping_lines: Option<Vec<models::CommerceOrderChargeLine>>,
    /// WooCommerce fees. Always empty on Shopify.
    #[serde(rename = "feeLines", skip_serializing_if = "Option::is_none")]
    pub fee_lines: Option<Vec<models::CommerceOrderChargeLine>>,
    /// Order tax by rate, line items and shipping together.
    #[serde(rename = "taxLines", skip_serializing_if = "Option::is_none")]
    pub tax_lines: Option<Vec<models::CommerceTaxLine>>,
    #[serde(rename = "refunds", skip_serializing_if = "Option::is_none")]
    pub refunds: Option<Vec<models::CommerceOrderRefundsInner>>,
    #[serde(rename = "fulfillments", skip_serializing_if = "Option::is_none")]
    pub fulfillments: Option<Vec<models::CommerceOrderFulfillmentsInner>>,
    /// Platform-only fields. Null when the platform has none.
    #[serde(
        rename = "platformData",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub platform_data: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
}

impl CommerceOrder {
    /// An order with what an invoice needs. Every amount is in `currency`, the store currency.
    pub fn new() -> CommerceOrder {
        CommerceOrder {
            id: None,
            account_id: None,
            platform: None,
            number: None,
            status: None,
            platform_status: None,
            payment_status: None,
            platform_payment_status: None,
            currency: None,
            taxes_included: None,
            created_at: None,
            updated_at: None,
            paid_at: None,
            cancelled_at: None,
            cancel_reason: None,
            subtotal: None,
            discount_total: None,
            shipping_total: None,
            tax_total: None,
            total: None,
            refunded_total: None,
            discount_codes: None,
            payment_methods: None,
            customer: None,
            billing_address: None,
            shipping_address: None,
            buyer_note: None,
            attribution: None,
            line_items: None,
            shipping_lines: None,
            fee_lines: None,
            tax_lines: None,
            refunds: None,
            fulfillments: None,
            platform_data: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
    #[serde(rename = "shopify")]
    Shopify,
    #[serde(rename = "woocommerce")]
    Woocommerce,
}

impl Default for Platform {
    fn default() -> Platform {
        Self::Shopify
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PaymentStatus {
    #[serde(rename = "pending")]
    Pending,
    #[serde(rename = "authorized")]
    Authorized,
    #[serde(rename = "partially_paid")]
    PartiallyPaid,
    #[serde(rename = "paid")]
    Paid,
    #[serde(rename = "partially_refunded")]
    PartiallyRefunded,
    #[serde(rename = "refunded")]
    Refunded,
    #[serde(rename = "voided")]
    Voided,
    #[serde(rename = "failed")]
    Failed,
}

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