late 0.0.772

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).
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).
 *
 * 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};

/// WebhookPayloadAdStatusChanged : Webhook payload for the `ad.status_changed` event. Currently emitted only for Meta (`metaads`).  Sourced from two Meta `ad_account` webhook fields:   - `in_process_ad_objects` - the ad object finished processing and     exited `IN_PROCESS`. `status.raw` carries Meta's `status_name`.   - `with_issues_ad_objects` - the ad object entered `WITH_ISSUES`.     `status.raw` is `WITH_ISSUES` and the `error` block is populated     from Meta's `error_code` / `error_summary` / `error_message`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadAdStatusChanged {
    /// Stable webhook event ID
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "event")]
    pub event: Event,
    #[serde(rename = "account")]
    pub account: Box<models::WebhookPayloadAdStatusChangedAccount>,
    #[serde(rename = "adObject")]
    pub ad_object: Box<models::WebhookPayloadAdStatusChangedAdObject>,
    #[serde(rename = "status")]
    pub status: Box<models::WebhookPayloadAdStatusChangedStatus>,
    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
    pub error: Option<Box<models::WebhookPayloadAdStatusChangedError>>,
    /// UTC time at which Zernio generated this event (set once when the event payload is built, before delivery is queued). Retries and redeliveries keep the original value, so it reflects the event, not the delivery attempt.
    #[serde(rename = "timestamp")]
    pub timestamp: String,
}

impl WebhookPayloadAdStatusChanged {
    /// Webhook payload for the `ad.status_changed` event. Currently emitted only for Meta (`metaads`).  Sourced from two Meta `ad_account` webhook fields:   - `in_process_ad_objects` - the ad object finished processing and     exited `IN_PROCESS`. `status.raw` carries Meta's `status_name`.   - `with_issues_ad_objects` - the ad object entered `WITH_ISSUES`.     `status.raw` is `WITH_ISSUES` and the `error` block is populated     from Meta's `error_code` / `error_summary` / `error_message`.
    pub fn new(
        id: String,
        event: Event,
        account: models::WebhookPayloadAdStatusChangedAccount,
        ad_object: models::WebhookPayloadAdStatusChangedAdObject,
        status: models::WebhookPayloadAdStatusChangedStatus,
        timestamp: String,
    ) -> WebhookPayloadAdStatusChanged {
        WebhookPayloadAdStatusChanged {
            id,
            event,
            account: Box::new(account),
            ad_object: Box::new(ad_object),
            status: Box::new(status),
            error: None,
            timestamp,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Event {
    #[serde(rename = "ad.status_changed")]
    AdStatusChanged,
}

impl Default for Event {
    fn default() -> Event {
        Self::AdStatusChanged
    }
}