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

/// RecyclingState : Current recycling configuration and state on a post
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RecyclingState {
    /// Whether recycling is currently active
    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    /// Number of interval units between reposts
    #[serde(rename = "gap", skip_serializing_if = "Option::is_none")]
    pub gap: Option<i32>,
    /// Interval unit (week or month)
    #[serde(rename = "gapFreq", skip_serializing_if = "Option::is_none")]
    pub gap_freq: Option<GapFreq>,
    #[serde(rename = "startDate", skip_serializing_if = "Option::is_none")]
    pub start_date: Option<String>,
    #[serde(rename = "expireCount", skip_serializing_if = "Option::is_none")]
    pub expire_count: Option<i32>,
    #[serde(rename = "expireDate", skip_serializing_if = "Option::is_none")]
    pub expire_date: Option<String>,
    /// Content variations for recycled copies (if configured)
    #[serde(rename = "contentVariations", skip_serializing_if = "Option::is_none")]
    pub content_variations: Option<Vec<String>>,
    /// Current position in the content variations rotation (read-only)
    #[serde(
        rename = "contentVariationIndex",
        skip_serializing_if = "Option::is_none"
    )]
    pub content_variation_index: Option<i32>,
    /// How many recycled copies have been created so far (read-only)
    #[serde(rename = "recycleCount", skip_serializing_if = "Option::is_none")]
    pub recycle_count: Option<i32>,
    /// When the next recycled copy will be created (read-only)
    #[serde(rename = "nextRecycleAt", skip_serializing_if = "Option::is_none")]
    pub next_recycle_at: Option<String>,
    /// When the last recycled copy was created (read-only)
    #[serde(rename = "lastRecycledAt", skip_serializing_if = "Option::is_none")]
    pub last_recycled_at: Option<String>,
}

impl RecyclingState {
    /// Current recycling configuration and state on a post
    pub fn new() -> RecyclingState {
        RecyclingState {
            enabled: None,
            gap: None,
            gap_freq: None,
            start_date: None,
            expire_count: None,
            expire_date: None,
            content_variations: None,
            content_variation_index: None,
            recycle_count: None,
            next_recycle_at: None,
            last_recycled_at: None,
        }
    }
}
/// Interval unit (week or 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
    }
}
