/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.0.0-rc.3
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// LifecyclePolicy : A lifecycle policy attached to a repository (or global if repository_id is NULL).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct LifecyclePolicy {
    #[serde(rename = "config")]
    pub config: serde_json::Value,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "cron_schedule", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub cron_schedule: Option<Option<String>>,
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    #[serde(rename = "enabled")]
    pub enabled: bool,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "last_run_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub last_run_at: Option<Option<String>>,
    #[serde(rename = "last_run_items_removed", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub last_run_items_removed: Option<Option<i64>>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "policy_type")]
    pub policy_type: String,
    #[serde(rename = "priority")]
    pub priority: i32,
    #[serde(rename = "repository_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub repository_id: Option<Option<uuid::Uuid>>,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
}

impl LifecyclePolicy {
    /// A lifecycle policy attached to a repository (or global if repository_id is NULL).
    pub fn new(config: serde_json::Value, created_at: String, enabled: bool, id: uuid::Uuid, name: String, policy_type: String, priority: i32, updated_at: String) -> LifecyclePolicy {
        LifecyclePolicy {
            config,
            created_at,
            cron_schedule: None,
            description: None,
            enabled,
            id,
            last_run_at: None,
            last_run_items_removed: None,
            name,
            policy_type,
            priority,
            repository_id: None,
            updated_at,
        }
    }
}

