/*
 * Artifact Keeper API
 *
 * REST API for Artifact Keeper, an open-source universal artifact registry. Covers user management, repositories, artifacts, search, security scanning, SBOM, dependency tracking, SSO, analytics, monitoring, telemetry, lifecycle policies, plugins, edge nodes, migration, and administration. Format-specific protocol endpoints (npm, PyPI, Maven, Docker/OCI, etc.) are not included; those follow their respective upstream specifications.
 *
 * The version of the OpenAPI document: 1.0.0-a2
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateLifecyclePolicyRequest {
    /// Repository to scope this policy to. When null the policy applies globally.
    #[serde(rename = "repository_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub repository_id: Option<Option<uuid::Uuid>>,
    /// Human-readable name for the policy.
    #[serde(rename = "name")]
    pub name: String,
    /// Optional longer description of the policy purpose.
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    /// Type of lifecycle policy (e.g. retention, cleanup, archive).
    #[serde(rename = "policy_type")]
    pub policy_type: String,
    /// Policy-type-specific configuration object.
    #[serde(rename = "config")]
    pub config: serde_json::Value,
    /// Execution priority. Lower values execute first.
    #[serde(rename = "priority", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub priority: Option<Option<i32>>,
}

impl CreateLifecyclePolicyRequest {
    pub fn new(name: String, policy_type: String, config: serde_json::Value) -> CreateLifecyclePolicyRequest {
        CreateLifecyclePolicyRequest {
            repository_id: None,
            name,
            description: None,
            policy_type,
            config,
            priority: None,
        }
    }
}

