late 0.0.1085

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

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

/// TrackingTag : A platform measurement tag: the thing you create, install on a website, send events to, and target ads against. On Meta this is a Pixel (`kind: pixel`). The shape is platform-neutral so other platforms (Pinterest Tag, LinkedIn Insight Tag, etc.) can be added without changing the contract; platform-specific fields are absent where a platform has no equivalent. Returned by `listTrackingTags`, `createTrackingTag`, `getTrackingTag`, and `updateTrackingTag`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TrackingTag {
    /// Platform-native tag id, the `{tagId}` of the per-tag routes. Meta: numeric pixel id, as a string. OpenAI: the pixel resource id. Google Ads: the 10-digit customer id (one Google tag per account).
    #[serde(rename = "id")]
    pub id: String,
    /// The id the on-site code carries. Equals `id` on Meta; differs on platforms with separate API and site ids (OpenAI `pixel_id`, Google `AW-...` conversion id, the manager's under cross-account conversion tracking).
    #[serde(rename = "siteTagId", skip_serializing_if = "Option::is_none")]
    pub site_tag_id: Option<String>,
    /// Platforms where each conversion is its own object: the tag's conversion events, with the id a site sends for each.
    #[serde(rename = "events", skip_serializing_if = "Option::is_none")]
    pub events: Option<Vec<models::TrackingTagEvent>>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "platform")]
    pub platform: Platform,
    /// Platform-native flavor of the tag (Meta: `pixel`).
    #[serde(rename = "kind")]
    pub kind: Kind,
    /// `inactive` when the platform reports the tag as broken/unavailable.
    #[serde(rename = "status")]
    pub status: Status,
    /// The base-code `<script>` snippet to install on the site, including the page-view call. Populated by `getTrackingTag`, omitted from the list view.
    #[serde(rename = "code", skip_serializing_if = "Option::is_none")]
    pub code: Option<String>,
    /// Unix seconds of the last event the tag received, or `null` if it never fired. The practical \"is it installed and working\" signal.
    #[serde(
        rename = "lastFiredTime",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub last_fired_time: Option<Option<i32>>,
    /// Whether the tag is in a broken/unavailable state (Meta `is_unavailable`).
    #[serde(rename = "isUnavailable", skip_serializing_if = "Option::is_none")]
    pub is_unavailable: Option<bool>,
    /// Convenience flag derived from `lastFiredTime`: has the tag ever fired.
    #[serde(rename = "installed", skip_serializing_if = "Option::is_none")]
    pub installed: Option<bool>,
    /// Unix seconds the tag was created.
    #[serde(rename = "creationTime", skip_serializing_if = "Option::is_none")]
    pub creation_time: Option<i32>,
    /// Customer data the tag matches automatically, where the platform reports it (Pinterest automatic enhanced match).
    #[serde(
        rename = "automaticMatchingFields",
        skip_serializing_if = "Option::is_none"
    )]
    pub automatic_matching_fields: Option<Vec<AutomaticMatchingFields>>,
    /// Business Manager id that owns the tag, or `null` when the tag lives on a personal (non-BM) ad account. Such tags can't be shared with other ad accounts.
    #[serde(
        rename = "ownerBusinessId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub owner_business_id: Option<Option<String>>,
    /// Ad account id (`act_...`) that owns the tag, when reported.
    #[serde(rename = "ownerAdAccountId", skip_serializing_if = "Option::is_none")]
    pub owner_ad_account_id: Option<String>,
    /// Google Ads: whether gclid auto-tagging is on for the ad account (needed to attribute conversions to clicks).
    #[serde(rename = "autoTagging", skip_serializing_if = "Option::is_none")]
    pub auto_tagging: Option<bool>,
}

impl TrackingTag {
    /// A platform measurement tag: the thing you create, install on a website, send events to, and target ads against. On Meta this is a Pixel (`kind: pixel`). The shape is platform-neutral so other platforms (Pinterest Tag, LinkedIn Insight Tag, etc.) can be added without changing the contract; platform-specific fields are absent where a platform has no equivalent. Returned by `listTrackingTags`, `createTrackingTag`, `getTrackingTag`, and `updateTrackingTag`.
    pub fn new(
        id: String,
        name: String,
        platform: Platform,
        kind: Kind,
        status: Status,
    ) -> TrackingTag {
        TrackingTag {
            id,
            site_tag_id: None,
            events: None,
            name,
            platform,
            kind,
            status,
            code: None,
            last_fired_time: None,
            is_unavailable: None,
            installed: None,
            creation_time: None,
            automatic_matching_fields: None,
            owner_business_id: None,
            owner_ad_account_id: None,
            auto_tagging: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
    #[serde(rename = "metaads")]
    Metaads,
    #[serde(rename = "openaiads")]
    Openaiads,
    #[serde(rename = "tiktokads")]
    Tiktokads,
    #[serde(rename = "googleads")]
    Googleads,
    #[serde(rename = "xads")]
    Xads,
    #[serde(rename = "linkedinads")]
    Linkedinads,
    #[serde(rename = "pinterestads")]
    Pinterestads,
}

impl Default for Platform {
    fn default() -> Platform {
        Self::Metaads
    }
}
/// Platform-native flavor of the tag (Meta: `pixel`).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Kind {
    #[serde(rename = "pixel")]
    Pixel,
    #[serde(rename = "tag")]
    Tag,
    #[serde(rename = "insight_tag")]
    InsightTag,
}

impl Default for Kind {
    fn default() -> Kind {
        Self::Pixel
    }
}
/// `inactive` when the platform reports the tag as broken/unavailable.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "active")]
    Active,
    #[serde(rename = "inactive")]
    Inactive,
}

impl Default for Status {
    fn default() -> Status {
        Self::Active
    }
}
/// Customer data the tag matches automatically, where the platform reports it (Pinterest automatic enhanced match).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AutomaticMatchingFields {
    #[serde(rename = "em")]
    Em,
    #[serde(rename = "ph")]
    Ph,
    #[serde(rename = "fn")]
    Fn,
    #[serde(rename = "ln")]
    Ln,
    #[serde(rename = "ge")]
    Ge,
    #[serde(rename = "db")]
    Db,
    #[serde(rename = "ct")]
    Ct,
    #[serde(rename = "st")]
    St,
    #[serde(rename = "zp")]
    Zp,
    #[serde(rename = "country")]
    Country,
    #[serde(rename = "external_id")]
    ExternalId,
}

impl Default for AutomaticMatchingFields {
    fn default() -> AutomaticMatchingFields {
        Self::Em
    }
}