late 0.0.1385

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.605.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 CampaignResultMetric {
    #[serde(rename = "key")]
    pub key: String,
    #[serde(rename = "label")]
    pub label: String,
    /// How the value reads: `percent` values are already multiplied by 100.
    #[serde(rename = "kind")]
    pub kind: Kind,
    #[serde(rename = "currency", deserialize_with = "Option::deserialize")]
    pub currency: Option<String>,
    /// Null for a number you send. For a computed metric, the formula over `spend`, `impressions`, `clicks`, `conversions`, `purchase_value` and the metrics you send, e.g. `spend / revenue * 100`.
    #[serde(rename = "formula", deserialize_with = "Option::deserialize")]
    pub formula: Option<String>,
    /// One of the formulas every team has (`cac_percent`, `cost_per_sale`, `cost_per_qualified_lead`, `lead_to_sale`, `qualified_rate`). Setting the same key replaces it for your team.
    #[serde(rename = "builtIn")]
    pub built_in: bool,
}

impl CampaignResultMetric {
    pub fn new(
        key: String,
        label: String,
        kind: Kind,
        currency: Option<String>,
        formula: Option<String>,
        built_in: bool,
    ) -> CampaignResultMetric {
        CampaignResultMetric {
            key,
            label,
            kind,
            currency,
            formula,
            built_in,
        }
    }
}
/// How the value reads: `percent` values are already multiplied by 100.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Kind {
    #[serde(rename = "count")]
    Count,
    #[serde(rename = "money")]
    Money,
    #[serde(rename = "percent")]
    Percent,
    #[serde(rename = "ratio")]
    Ratio,
}

impl Default for Kind {
    fn default() -> Kind {
        Self::Count
    }
}