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

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PromotionRuleResponse {
    #[serde(rename = "allowed_licenses", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub allowed_licenses: Option<Option<Vec<String>>>,
    #[serde(rename = "auto_promote")]
    pub auto_promote: bool,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "is_enabled")]
    pub is_enabled: bool,
    #[serde(rename = "max_artifact_age_days", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub max_artifact_age_days: Option<Option<i32>>,
    #[serde(rename = "max_cve_severity", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub max_cve_severity: Option<Option<String>>,
    #[serde(rename = "min_health_score", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub min_health_score: Option<Option<i32>>,
    #[serde(rename = "min_staging_hours", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub min_staging_hours: Option<Option<i32>>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "require_signature")]
    pub require_signature: bool,
    #[serde(rename = "source_repo_id")]
    pub source_repo_id: uuid::Uuid,
    #[serde(rename = "target_repo_id")]
    pub target_repo_id: uuid::Uuid,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
}

impl PromotionRuleResponse {
    pub fn new(auto_promote: bool, created_at: String, id: uuid::Uuid, is_enabled: bool, name: String, require_signature: bool, source_repo_id: uuid::Uuid, target_repo_id: uuid::Uuid, updated_at: String) -> PromotionRuleResponse {
        PromotionRuleResponse {
            allowed_licenses: None,
            auto_promote,
            created_at,
            id,
            is_enabled,
            max_artifact_age_days: None,
            max_cve_severity: None,
            min_health_score: None,
            min_staging_hours: None,
            name,
            require_signature,
            source_repo_id,
            target_repo_id,
            updated_at,
        }
    }
}

