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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateWebhookSettingsRequest {
    /// Webhook ID to update (required)
    #[serde(rename = "_id")]
    pub _id: String,
    /// Webhook name (1-50 characters). Must be non-empty if provided.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Webhook endpoint URL (must be a valid URL, whitespace trimmed). Must be a valid URL if provided.
    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
    pub url: Option<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. Must contain at least one event if provided.
    #[serde(rename = "events", skip_serializing_if = "Option::is_none")]
    pub events: Option<Vec<Events>>,
    /// Enable or disable webhook delivery
    #[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 UpdateWebhookSettingsRequest {
    pub fn new(_id: String) -> UpdateWebhookSettingsRequest {
        UpdateWebhookSettingsRequest {
            _id,
            name: None,
            url: None,
            secret: None,
            events: None,
            is_active: None,
            custom_headers: None,
        }
    }
}
/// Events to subscribe to. Must contain at least one event if provided.
#[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 = "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 = "comment.received")]
    CommentReceived,
    #[serde(rename = "review.new")]
    ReviewNew,
    #[serde(rename = "review.updated")]
    ReviewUpdated,
    #[serde(rename = "ad.status_changed")]
    AdStatusChanged,
}

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