/*
* 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.168.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 CommerceDiscount {
#[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>,
#[serde(rename = "title", skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[serde(rename = "method", skip_serializing_if = "Option::is_none")]
pub method: Option<Method>,
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub r#type: Option<Type>,
/// The first 10 codes; codeCount has the total.
#[serde(rename = "codes", skip_serializing_if = "Option::is_none")]
pub codes: Option<Vec<String>>,
#[serde(
rename = "codeCount",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub code_count: Option<Option<i32>>,
#[serde(
rename = "value",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub value: Option<Option<Box<models::CommerceDiscountValue>>>,
#[serde(rename = "appliesTo", skip_serializing_if = "Option::is_none")]
pub applies_to: Option<Box<models::CommerceDiscountAppliesTo>>,
#[serde(rename = "minimum", skip_serializing_if = "Option::is_none")]
pub minimum: Option<Box<models::CommerceDiscountMinimum>>,
#[serde(
rename = "usageLimit",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub usage_limit: Option<Option<i32>>,
#[serde(rename = "oncePerCustomer", skip_serializing_if = "Option::is_none")]
pub once_per_customer: Option<bool>,
#[serde(rename = "usageCount", skip_serializing_if = "Option::is_none")]
pub usage_count: Option<i32>,
#[serde(rename = "startsAt", skip_serializing_if = "Option::is_none")]
pub starts_at: Option<String>,
#[serde(
rename = "endsAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub ends_at: Option<Option<String>>,
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<Status>,
#[serde(rename = "platformStatus", skip_serializing_if = "Option::is_none")]
pub platform_status: Option<String>,
#[serde(rename = "summary", skip_serializing_if = "Option::is_none")]
pub summary: Option<String>,
#[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 CommerceDiscount {
pub fn new() -> CommerceDiscount {
CommerceDiscount {
id: None,
account_id: None,
platform: None,
title: None,
method: None,
r#type: None,
codes: None,
code_count: None,
value: None,
applies_to: None,
minimum: None,
usage_limit: None,
once_per_customer: None,
usage_count: None,
starts_at: None,
ends_at: None,
status: None,
platform_status: None,
summary: None,
platform_data: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
#[serde(rename = "shopify")]
Shopify,
}
impl Default for Platform {
fn default() -> Platform {
Self::Shopify
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Method {
#[serde(rename = "code")]
Code,
#[serde(rename = "automatic")]
Automatic,
}
impl Default for Method {
fn default() -> Method {
Self::Code
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "percentage")]
Percentage,
#[serde(rename = "fixed_amount")]
FixedAmount,
#[serde(rename = "free_shipping")]
FreeShipping,
#[serde(rename = "buy_x_get_y")]
BuyXGetY,
#[serde(rename = "app")]
App,
}
impl Default for Type {
fn default() -> Type {
Self::Percentage
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "active")]
Active,
#[serde(rename = "scheduled")]
Scheduled,
#[serde(rename = "expired")]
Expired,
}
impl Default for Status {
fn default() -> Status {
Self::Active
}
}