late 0.0.306

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
Documentation
/*
 * 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 CreateCommentAutomationRequest {
    #[serde(rename = "profileId")]
    pub profile_id: String,
    /// Instagram or Facebook account ID
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// What fires the automation. 'comment' (keyword comment on a post) or 'story_reply' (keyword reply to an Instagram story). For 'story_reply', platformPostId is the story media id (omit for any story).
    #[serde(rename = "trigger", skip_serializing_if = "Option::is_none")]
    pub trigger: Option<Trigger>,
    /// Platform media/post ID (or story media id when trigger=story_reply). Omit for an account-wide (any-post / any-story) automation.
    #[serde(rename = "platformPostId", skip_serializing_if = "Option::is_none")]
    pub platform_post_id: Option<String>,
    /// Zernio post ID. Required only when also targeting a specific post via platformPostId.
    #[serde(rename = "postId", skip_serializing_if = "Option::is_none")]
    pub post_id: Option<String>,
    /// Post content snippet for display
    #[serde(rename = "postTitle", skip_serializing_if = "Option::is_none")]
    pub post_title: Option<String>,
    /// Automation label
    #[serde(rename = "name")]
    pub name: String,
    /// Trigger keywords (empty = any comment triggers)
    #[serde(rename = "keywords", skip_serializing_if = "Option::is_none")]
    pub keywords: Option<Vec<String>>,
    #[serde(rename = "matchMode", skip_serializing_if = "Option::is_none")]
    pub match_mode: Option<MatchMode>,
    /// DM text to send to commenter. Max 640 chars when buttons are set, otherwise ~1000.
    #[serde(rename = "dmMessage")]
    pub dm_message: String,
    /// Optional inline DM buttons (1-3). Phone buttons are Facebook-only. Omit or pass [] for a plain-text DM.
    #[serde(rename = "buttons", skip_serializing_if = "Option::is_none")]
    pub buttons: Option<Vec<models::DmButton>>,
    /// Optional public reply to the comment
    #[serde(rename = "commentReply", skip_serializing_if = "Option::is_none")]
    pub comment_reply: Option<String>,
    /// Wrap link buttons in the DM in a tracked redirect so clicks are counted (Link Clicks / CTR). Pass false to send links exactly as written. Defaults to on.
    #[serde(rename = "linkTracking", skip_serializing_if = "Option::is_none")]
    pub link_tracking: Option<bool>,
    /// Optional tag applied to a contact when they click a tracked link (requires linkTracking). Lets you segment clickers for broadcasts/sequences.
    #[serde(rename = "clickTag", skip_serializing_if = "Option::is_none")]
    pub click_tag: Option<String>,
}

impl CreateCommentAutomationRequest {
    pub fn new(
        profile_id: String,
        account_id: String,
        name: String,
        dm_message: String,
    ) -> CreateCommentAutomationRequest {
        CreateCommentAutomationRequest {
            profile_id,
            account_id,
            trigger: None,
            platform_post_id: None,
            post_id: None,
            post_title: None,
            name,
            keywords: None,
            match_mode: None,
            dm_message,
            buttons: None,
            comment_reply: None,
            link_tracking: None,
            click_tag: None,
        }
    }
}
/// What fires the automation. 'comment' (keyword comment on a post) or 'story_reply' (keyword reply to an Instagram story). For 'story_reply', platformPostId is the story media id (omit for any story).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Trigger {
    #[serde(rename = "comment")]
    Comment,
    #[serde(rename = "story_reply")]
    StoryReply,
}

impl Default for Trigger {
    fn default() -> Trigger {
        Self::Comment
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum MatchMode {
    #[serde(rename = "exact")]
    Exact,
    #[serde(rename = "contains")]
    Contains,
}

impl Default for MatchMode {
    fn default() -> MatchMode {
        Self::Exact
    }
}