late 0.0.1301

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.432.1
 * 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 AdRuleCondition {
    #[serde(rename = "metric", deserialize_with = "Option::deserialize")]
    pub metric: Option<Metric>,
    /// Days in the ad account's own timezone. `last_7d` is the 7 full days before today; only `today` reads the day in progress.
    #[serde(rename = "window")]
    pub window: Window,
    #[serde(rename = "op")]
    pub op: Op,
    #[serde(rename = "value")]
    pub value: f64,
}

impl AdRuleCondition {
    pub fn new(metric: Option<Metric>, window: Window, op: Op, value: f64) -> AdRuleCondition {
        AdRuleCondition {
            metric,
            window,
            op,
            value,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Metric {
    #[serde(rename = "spend")]
    Spend,
    #[serde(rename = "impressions")]
    Impressions,
    #[serde(rename = "clicks")]
    Clicks,
    #[serde(rename = "conversions")]
    Conversions,
    #[serde(rename = "ctr")]
    Ctr,
    #[serde(rename = "cpc")]
    Cpc,
    #[serde(rename = "cpm")]
    Cpm,
    #[serde(rename = "cpa")]
    Cpa,
    #[serde(rename = "roas")]
    Roas,
    #[serde(rename = "reach")]
    Reach,
    #[serde(rename = "frequency")]
    Frequency,
}

impl Default for Metric {
    fn default() -> Metric {
        Self::Spend
    }
}
/// Days in the ad account's own timezone. `last_7d` is the 7 full days before today; only `today` reads the day in progress.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Window {
    #[serde(rename = "today")]
    Today,
    #[serde(rename = "yesterday")]
    Yesterday,
    #[serde(rename = "last_3d")]
    Last3d,
    #[serde(rename = "last_7d")]
    Last7d,
    #[serde(rename = "last_14d")]
    Last14d,
    #[serde(rename = "last_30d")]
    Last30d,
}

impl Default for Window {
    fn default() -> Window {
        Self::Today
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Op {
    #[serde(rename = ">")]
    GreaterThan,
    #[serde(rename = ">=")]
    GreaterThanEqual,
    #[serde(rename = "<")]
    LessThan,
    #[serde(rename = "<=")]
    LessThanEqual,
}

impl Default for Op {
    fn default() -> Op {
        Self::GreaterThan
    }
}