late 0.0.1055

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

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

/// ValueRuleCriterion : One matching condition inside a value rule. `criteriaValues` and `criteriaValueTypes` are POSITIONALLY paired: same length, same order.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ValueRuleCriterion {
    /// Platform criterion id. Echo it on `PUT` to KEEP this criterion, omit it to CREATE a new one. A criterion left out of the array entirely is DELETED.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// The dimension being matched. `OMNI_CHANNEL` (conversion location: APP, INSTANT_FORM, PHONE_CALL, WEBSITE) is accepted even though Meta's own enum table omits it.
    #[serde(rename = "criteriaType")]
    pub criteria_type: CriteriaType,
    /// Required on every criterion. `CONTAINS` is currently the only value Meta supports.
    #[serde(rename = "operator")]
    pub operator: Operator,
    /// The values to match. `AGE` takes ranges such as `18-24`, `18+` or a custom `18-26`; a range whose upper bound is 65 is NOT allowed (use `18+` instead of `18-65`). `LOCATION` takes Targeting-Search keys: a two-letter country code for `LOCATION_COUNTRY`, a numeric key for region / city / comScore market. `AUDIENCE_LABEL` takes labels such as `HIGH_VALUE`, which are applied to a Custom Audience in Ads Manager: there is no API to provision them, so they are passed through unvalidated.
    #[serde(rename = "criteriaValues")]
    pub criteria_values: Vec<String>,
    /// One entry per `criteriaValues` entry, in the same order. The literal `\"NONE\"` for every criteriaType except `LOCATION`, which uses `LOCATION_COUNTRY`, `LOCATION_REGION`, `LOCATION_CITY` or `LOCATION_COMSCORE_MARKET` and MAY mix them within one criterion. `LOCATION_DMA` was replaced by `LOCATION_COMSCORE_MARKET` on 2026-06-22 and is rejected by this API.
    #[serde(rename = "criteriaValueTypes")]
    pub criteria_value_types: Vec<String>,
}

impl ValueRuleCriterion {
    /// One matching condition inside a value rule. `criteriaValues` and `criteriaValueTypes` are POSITIONALLY paired: same length, same order.
    pub fn new(
        criteria_type: CriteriaType,
        operator: Operator,
        criteria_values: Vec<String>,
        criteria_value_types: Vec<String>,
    ) -> ValueRuleCriterion {
        ValueRuleCriterion {
            id: None,
            criteria_type,
            operator,
            criteria_values,
            criteria_value_types,
        }
    }
}
/// The dimension being matched. `OMNI_CHANNEL` (conversion location: APP, INSTANT_FORM, PHONE_CALL, WEBSITE) is accepted even though Meta's own enum table omits it.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CriteriaType {
    #[serde(rename = "AGE")]
    Age,
    #[serde(rename = "GENDER")]
    Gender,
    #[serde(rename = "OS_TYPE")]
    OsType,
    #[serde(rename = "DEVICE_PLATFORM")]
    DevicePlatform,
    #[serde(rename = "LOCATION")]
    Location,
    #[serde(rename = "PLACEMENT")]
    Placement,
    #[serde(rename = "OMNI_CHANNEL")]
    OmniChannel,
    #[serde(rename = "AUDIENCE_LABEL")]
    AudienceLabel,
}

impl Default for CriteriaType {
    fn default() -> CriteriaType {
        Self::Age
    }
}
/// Required on every criterion. `CONTAINS` is currently the only value Meta supports.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Operator {
    #[serde(rename = "CONTAINS")]
    Contains,
}

impl Default for Operator {
    fn default() -> Operator {
        Self::Contains
    }
}