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

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

/// Lead : A single lead submission returned by the leads endpoint and the lead.received webhook.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Lead {
    /// Meta `leadgen_id`.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(rename = "createdTime", skip_serializing_if = "Option::is_none")]
    pub created_time: Option<String>,
    /// Meta ad ID that surfaced the form. Organic leads omit this.
    #[serde(rename = "adId", skip_serializing_if = "Option::is_none")]
    pub ad_id: Option<String>,
    #[serde(rename = "formId", skip_serializing_if = "Option::is_none")]
    pub form_id: Option<String>,
    /// Flattened key→value map of answers (multi-value fields joined with \", \").
    #[serde(rename = "fields", skip_serializing_if = "Option::is_none")]
    pub fields: Option<std::collections::HashMap<String, String>>,
    /// Raw `field_data` from Meta (one entry per question).
    #[serde(rename = "fieldData", skip_serializing_if = "Option::is_none")]
    pub field_data: Option<Vec<models::LeadFieldDataInner>>,
}

impl Lead {
    /// A single lead submission returned by the leads endpoint and the lead.received webhook.
    pub fn new() -> Lead {
        Lead {
            id: None,
            created_time: None,
            ad_id: None,
            form_id: None,
            fields: None,
            field_data: None,
        }
    }
}
