/*
* 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).
*
* The version of the OpenAPI document: 1.0.4
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// MetaPromotion : Meta explicit Promotion offer. Maps to creative_sourcing_spec.promotion_metadata_spec with promotion_source ADVERTISER_INPUT. Dates become Unix seconds. Send null to omit an explicit offer on a new creative or remove it when rebuilding. Creation success alone does not confirm application: inspect promotionStatus in the response.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetaPromotion {
/// Promotion type accepted by Meta. PERCENTAGE_OFF values cannot exceed 100.
#[serde(rename = "type")]
pub r#type: Type,
/// Nonnegative promotion value passed to Meta unchanged. AMOUNT_OFF units are not confirmed, including major versus minor currency units. For PERCENTAGE_OFF this is the percentage discount, at most 100.
#[serde(rename = "value")]
pub value: f64,
/// Optional promotion code.
#[serde(rename = "code", skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
/// Optional ISO 8601 start timestamp with a timezone offset or Z.
#[serde(rename = "startDate", skip_serializing_if = "Option::is_none")]
pub start_date: Option<String>,
/// Optional ISO 8601 end timestamp with a timezone offset or Z. Must be after startDate when both are set.
#[serde(rename = "endDate", skip_serializing_if = "Option::is_none")]
pub end_date: Option<String>,
}
impl MetaPromotion {
/// Meta explicit Promotion offer. Maps to creative_sourcing_spec.promotion_metadata_spec with promotion_source ADVERTISER_INPUT. Dates become Unix seconds. Send null to omit an explicit offer on a new creative or remove it when rebuilding. Creation success alone does not confirm application: inspect promotionStatus in the response.
pub fn new(r#type: Type, value: f64) -> MetaPromotion {
MetaPromotion {
r#type,
value,
code: None,
start_date: None,
end_date: None,
}
}
}
/// Promotion type accepted by Meta. PERCENTAGE_OFF values cannot exceed 100.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "AMOUNT_OFF")]
AmountOff,
#[serde(rename = "FREE_RETURN")]
FreeReturn,
#[serde(rename = "FREE_SHIPPING")]
FreeShipping,
#[serde(rename = "PERCENTAGE_OFF")]
PercentageOff,
#[serde(rename = "PROMO_CODE")]
PromoCode,
}
impl Default for Type {
fn default() -> Type {
Self::AmountOff
}
}