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

/// TikTokPlatformData : Photo carousels up to 35 images. Video titles up to 2200 chars, photo titles truncated to 90 chars. privacyLevel must match creator_info options. Both camelCase and snake_case accepted.  **Creator Inbox (draft mode):** Set `draft: true` to send content to the TikTok Creator Inbox instead of publishing immediately. The creator receives an inbox notification and completes the post using TikTok's editing flow. This maps to TikTok's `post_mode: \"MEDIA_UPLOAD\"` internally.  **Important:** The field `publish_type` is NOT supported. Use `draft: true` for Creator Inbox flow.  **Photo drafts** use the `/v2/post/publish/content/init/` endpoint with `post_mode: \"MEDIA_UPLOAD\"`. **Video drafts** use the dedicated `/v2/post/publish/inbox/video/init/` endpoint.  When `draft: true`, the `video.upload` scope is required. When `draft` is false or omitted (direct post), the `video.publish` scope is required. For Creator Inbox, TikTok app version must be 31.8 or higher.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TikTokPlatformData {
    /// When true, sends the post to the TikTok Creator Inbox as a draft instead of publishing immediately. The creator receives an inbox notification to complete posting via TikTok's editing flow. Maps to TikTok API `post_mode: \"MEDIA_UPLOAD\"` (photos) or the dedicated inbox endpoint (videos). When false or omitted, publishes directly via `post_mode: \"DIRECT_POST\"`. Note: `publish_type` is not a supported field. Use this field instead.
    #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
    pub draft: Option<bool>,
    /// One of the values returned by the TikTok creator info API for the account
    #[serde(rename = "privacyLevel", skip_serializing_if = "Option::is_none")]
    pub privacy_level: Option<String>,
    /// Allow comments on the post
    #[serde(rename = "allowComment", skip_serializing_if = "Option::is_none")]
    pub allow_comment: Option<bool>,
    /// Allow duets (required for video posts)
    #[serde(rename = "allowDuet", skip_serializing_if = "Option::is_none")]
    pub allow_duet: Option<bool>,
    /// Allow stitches (required for video posts)
    #[serde(rename = "allowStitch", skip_serializing_if = "Option::is_none")]
    pub allow_stitch: Option<bool>,
    /// Type of commercial content disclosure
    #[serde(
        rename = "commercialContentType",
        skip_serializing_if = "Option::is_none"
    )]
    pub commercial_content_type: Option<CommercialContentType>,
    /// Whether the post promotes a brand partner
    #[serde(
        rename = "brandPartnerPromote",
        skip_serializing_if = "Option::is_none"
    )]
    pub brand_partner_promote: Option<bool>,
    /// Whether the post is a brand organic post
    #[serde(rename = "isBrandOrganicPost", skip_serializing_if = "Option::is_none")]
    pub is_brand_organic_post: Option<bool>,
    /// User has confirmed they previewed the content
    #[serde(
        rename = "contentPreviewConfirmed",
        skip_serializing_if = "Option::is_none"
    )]
    pub content_preview_confirmed: Option<bool>,
    /// User has given express consent for posting
    #[serde(
        rename = "expressConsentGiven",
        skip_serializing_if = "Option::is_none"
    )]
    pub express_consent_given: Option<bool>,
    /// Optional override. Defaults based on provided media items.
    #[serde(rename = "mediaType", skip_serializing_if = "Option::is_none")]
    pub media_type: Option<MediaType>,
    /// Optional for video posts. Timestamp in milliseconds to select which frame to use as thumbnail (defaults to 1000ms/1 second). Ignored when videoCoverImageUrl is provided.
    #[serde(
        rename = "videoCoverTimestampMs",
        skip_serializing_if = "Option::is_none"
    )]
    pub video_cover_timestamp_ms: Option<i32>,
    /// Optional for video posts. URL of a custom thumbnail image (JPG, PNG, or WebP, max 20MB). The image is stitched as a single frame at the start of the video and used as the cover. Overrides videoCoverTimestampMs when provided.
    #[serde(rename = "videoCoverImageUrl", skip_serializing_if = "Option::is_none")]
    pub video_cover_image_url: Option<String>,
    /// Optional for photo carousels. Index of image to use as cover, 0-based (defaults to 0/first image).
    #[serde(rename = "photoCoverIndex", skip_serializing_if = "Option::is_none")]
    pub photo_cover_index: Option<i32>,
    /// When true, TikTok may add recommended music (photos only)
    #[serde(rename = "autoAddMusic", skip_serializing_if = "Option::is_none")]
    pub auto_add_music: Option<bool>,
    /// Set true to disclose AI-generated content
    #[serde(rename = "videoMadeWithAi", skip_serializing_if = "Option::is_none")]
    pub video_made_with_ai: Option<bool>,
    /// Optional long-form description for photo posts (max 4000 chars). Recommended when content exceeds 90 chars, as photo titles are auto-truncated.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
}

impl TikTokPlatformData {
    /// Photo carousels up to 35 images. Video titles up to 2200 chars, photo titles truncated to 90 chars. privacyLevel must match creator_info options. Both camelCase and snake_case accepted.  **Creator Inbox (draft mode):** Set `draft: true` to send content to the TikTok Creator Inbox instead of publishing immediately. The creator receives an inbox notification and completes the post using TikTok's editing flow. This maps to TikTok's `post_mode: \"MEDIA_UPLOAD\"` internally.  **Important:** The field `publish_type` is NOT supported. Use `draft: true` for Creator Inbox flow.  **Photo drafts** use the `/v2/post/publish/content/init/` endpoint with `post_mode: \"MEDIA_UPLOAD\"`. **Video drafts** use the dedicated `/v2/post/publish/inbox/video/init/` endpoint.  When `draft: true`, the `video.upload` scope is required. When `draft` is false or omitted (direct post), the `video.publish` scope is required. For Creator Inbox, TikTok app version must be 31.8 or higher.
    pub fn new() -> TikTokPlatformData {
        TikTokPlatformData {
            draft: None,
            privacy_level: None,
            allow_comment: None,
            allow_duet: None,
            allow_stitch: None,
            commercial_content_type: None,
            brand_partner_promote: None,
            is_brand_organic_post: None,
            content_preview_confirmed: None,
            express_consent_given: None,
            media_type: None,
            video_cover_timestamp_ms: None,
            video_cover_image_url: None,
            photo_cover_index: None,
            auto_add_music: None,
            video_made_with_ai: None,
            description: None,
        }
    }
}
/// Type of commercial content disclosure
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CommercialContentType {
    #[serde(rename = "none")]
    None,
    #[serde(rename = "brand_organic")]
    BrandOrganic,
    #[serde(rename = "brand_content")]
    BrandContent,
}

impl Default for CommercialContentType {
    fn default() -> CommercialContentType {
        Self::None
    }
}
/// Optional override. Defaults based on provided media items.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum MediaType {
    #[serde(rename = "video")]
    Video,
    #[serde(rename = "photo")]
    Photo,
}

impl Default for MediaType {
    fn default() -> MediaType {
        Self::Video
    }
}
