/*
* 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};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadLeadLead {
/// Zernio lead ID (AdLead document ID)
#[serde(rename = "id")]
pub id: String,
/// Meta lead ID (the platform's leadgen_id)
#[serde(rename = "leadgenId")]
pub leadgen_id: String,
/// Lead Gen form ID the lead was submitted against
#[serde(rename = "formId")]
pub form_id: String,
/// Human-readable form name (best-effort; may be null)
#[serde(
rename = "formName",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub form_name: Option<Option<String>>,
/// Meta ad ID that drove the lead (null for organic/test leads)
#[serde(
rename = "adId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub ad_id: Option<Option<String>>,
#[serde(
rename = "adsetId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub adset_id: Option<Option<String>>,
#[serde(
rename = "campaignId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub campaign_id: Option<Option<String>>,
/// Flattened question key -> answer map. For multiple-choice questions the value is the option key (e.g. \"k1\"), not the display label.
#[serde(rename = "fields")]
pub fields: std::collections::HashMap<String, String>,
/// True when the lead came from an organic post rather than a paid ad
#[serde(rename = "isOrganic")]
pub is_organic: bool,
/// Meta's lead creation time (ISO 8601)
#[serde(rename = "createdAt")]
pub created_at: String,
}
impl WebhookPayloadLeadLead {
pub fn new(
id: String,
leadgen_id: String,
form_id: String,
fields: std::collections::HashMap<String, String>,
is_organic: bool,
created_at: String,
) -> WebhookPayloadLeadLead {
WebhookPayloadLeadLead {
id,
leadgen_id,
form_id,
form_name: None,
ad_id: None,
adset_id: None,
campaign_id: None,
fields,
is_organic,
created_at,
}
}
}