/*
 * 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};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateWebhookSettingsRequest {
    /// Webhook name (1-50 characters)
    #[serde(rename = "name")]
    pub name: String,
    /// Webhook endpoint URL (must be a valid URL, whitespace trimmed)
    #[serde(rename = "url")]
    pub url: String,
    /// Secret key for HMAC-SHA256 signature verification
    #[serde(rename = "secret", skip_serializing_if = "Option::is_none")]
    pub secret: Option<String>,
    /// Events to subscribe to (at least one required)
    #[serde(rename = "events")]
    pub events: Vec<Events>,
    /// Enable or disable webhook delivery. Defaults to `true` when omitted.
    #[serde(rename = "isActive", skip_serializing_if = "Option::is_none")]
    pub is_active: Option<bool>,
    /// Custom headers to include in webhook requests
    #[serde(rename = "customHeaders", skip_serializing_if = "Option::is_none")]
    pub custom_headers: Option<std::collections::HashMap<String, String>>,
}

impl CreateWebhookSettingsRequest {
    pub fn new(name: String, url: String, events: Vec<Events>) -> CreateWebhookSettingsRequest {
        CreateWebhookSettingsRequest {
            name,
            url,
            secret: None,
            events,
            is_active: None,
            custom_headers: None,
        }
    }
}
/// Events to subscribe to (at least one required)
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Events {
    #[serde(rename = "post.scheduled")]
    PostScheduled,
    #[serde(rename = "post.published")]
    PostPublished,
    #[serde(rename = "post.failed")]
    PostFailed,
    #[serde(rename = "post.partial")]
    PostPartial,
    #[serde(rename = "post.cancelled")]
    PostCancelled,
    #[serde(rename = "post.recycled")]
    PostRecycled,
    #[serde(rename = "post.platform.published")]
    PostPlatformPublished,
    #[serde(rename = "post.platform.failed")]
    PostPlatformFailed,
    #[serde(rename = "post.external.created")]
    PostExternalCreated,
    #[serde(rename = "post.external.updated")]
    PostExternalUpdated,
    #[serde(rename = "post.external.deleted")]
    PostExternalDeleted,
    #[serde(rename = "account.connected")]
    AccountConnected,
    #[serde(rename = "account.disconnected")]
    AccountDisconnected,
    #[serde(rename = "account.ads.initial_sync_completed")]
    AccountAdsInitialSyncCompleted,
    #[serde(rename = "message.received")]
    MessageReceived,
    #[serde(rename = "message.sent")]
    MessageSent,
    #[serde(rename = "message.edited")]
    MessageEdited,
    #[serde(rename = "message.deleted")]
    MessageDeleted,
    #[serde(rename = "message.delivered")]
    MessageDelivered,
    #[serde(rename = "message.read")]
    MessageRead,
    #[serde(rename = "message.failed")]
    MessageFailed,
    #[serde(rename = "reaction.received")]
    ReactionReceived,
    #[serde(rename = "comment.received")]
    CommentReceived,
    #[serde(rename = "review.new")]
    ReviewNew,
    #[serde(rename = "review.updated")]
    ReviewUpdated,
    #[serde(rename = "ad.status_changed")]
    AdStatusChanged,
    #[serde(rename = "whatsapp.template.status_updated")]
    WhatsappTemplateStatusUpdated,
    #[serde(rename = "whatsapp.number.activated")]
    WhatsappNumberActivated,
    #[serde(rename = "whatsapp.number.declined")]
    WhatsappNumberDeclined,
    #[serde(rename = "whatsapp.number.action_required")]
    WhatsappNumberActionRequired,
    #[serde(rename = "whatsapp.number.verification_required")]
    WhatsappNumberVerificationRequired,
    #[serde(rename = "whatsapp.number.suspended")]
    WhatsappNumberSuspended,
    #[serde(rename = "whatsapp.number.reactivated")]
    WhatsappNumberReactivated,
    #[serde(rename = "whatsapp.number.released")]
    WhatsappNumberReleased,
    #[serde(rename = "whatsapp.number.kyc_submitted")]
    WhatsappNumberKycSubmitted,
}

impl Default for Events {
    fn default() -> Events {
        Self::PostScheduled
    }
}
