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

/// RecyclingConfig : Configure automatic post recycling (reposting at regular intervals). After the post is published, the system creates new scheduled copies at the specified interval until expiration conditions are met. Supports weekly or monthly intervals. Maximum 10 active recycling posts per account. YouTube and TikTok platforms are excluded from recycling. Content variations are recommended for Twitter and Pinterest to avoid duplicate flags.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RecyclingConfig {
    /// Set to false to disable recycling on this post
    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    /// Number of interval units between each repost. Required when enabling recycling.
    #[serde(rename = "gap", skip_serializing_if = "Option::is_none")]
    pub gap: Option<i32>,
    /// Interval unit for the gap. Defaults to 'month'.
    #[serde(rename = "gapFreq", skip_serializing_if = "Option::is_none")]
    pub gap_freq: Option<GapFreq>,
    /// When to start the recycling cycle. Defaults to the post's scheduledFor date.
    #[serde(rename = "startDate", skip_serializing_if = "Option::is_none")]
    pub start_date: Option<String>,
    /// Stop recycling after this many copies have been created. Send null on update to clear this limit.
    #[serde(rename = "expireCount", skip_serializing_if = "Option::is_none")]
    pub expire_count: Option<i32>,
    /// Stop recycling after this date, regardless of count. Send null on update to clear this limit.
    #[serde(rename = "expireDate", skip_serializing_if = "Option::is_none")]
    pub expire_date: Option<String>,
    /// Array of content variations for recycled copies. On each recycle, the next variation is used in round-robin order. Recommended for Twitter and Pinterest to avoid duplicate content flags. If omitted, the original post content is used for all recycled copies. Send an empty array [] to clear existing variations. Must have 2+ entries when setting variations. Platform-level customContent still overrides the base content per platform.
    #[serde(rename = "contentVariations", skip_serializing_if = "Option::is_none")]
    pub content_variations: Option<Vec<String>>,
}

impl RecyclingConfig {
    /// Configure automatic post recycling (reposting at regular intervals). After the post is published, the system creates new scheduled copies at the specified interval until expiration conditions are met. Supports weekly or monthly intervals. Maximum 10 active recycling posts per account. YouTube and TikTok platforms are excluded from recycling. Content variations are recommended for Twitter and Pinterest to avoid duplicate flags.
    pub fn new() -> RecyclingConfig {
        RecyclingConfig {
            enabled: None,
            gap: None,
            gap_freq: None,
            start_date: None,
            expire_count: None,
            expire_date: None,
            content_variations: None,
        }
    }
}
/// Interval unit for the gap. Defaults to 'month'.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum GapFreq {
    #[serde(rename = "week")]
    Week,
    #[serde(rename = "month")]
    Month,
}

impl Default for GapFreq {
    fn default() -> GapFreq {
        Self::Week
    }
}
