/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * 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};

/// WebhookPayloadLead : Webhook payload for lead.received events (Meta Lead Gen / Instant Forms).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadLead {
    /// Stable webhook event ID
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "event")]
    pub event: Event,
    #[serde(rename = "lead")]
    pub lead: Box<models::WebhookPayloadLeadLead>,
    #[serde(rename = "account")]
    pub account: Box<models::WebhookPayloadLeadAccount>,
    #[serde(rename = "timestamp")]
    pub timestamp: String,
}

impl WebhookPayloadLead {
    /// Webhook payload for lead.received events (Meta Lead Gen / Instant Forms).
    pub fn new(
        id: String,
        event: Event,
        lead: models::WebhookPayloadLeadLead,
        account: models::WebhookPayloadLeadAccount,
        timestamp: String,
    ) -> WebhookPayloadLead {
        WebhookPayloadLead {
            id,
            event,
            lead: Box::new(lead),
            account: Box::new(account),
            timestamp,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Event {
    #[serde(rename = "lead.received")]
    LeadReceived,
}

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