/*
 * 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 PromotionResponse {
    /// Whether the artifact was successfully promoted.
    #[serde(rename = "promoted")]
    pub promoted: bool,
    /// Source repository key.
    #[serde(rename = "source")]
    pub source: String,
    /// Target repository key.
    #[serde(rename = "target")]
    pub target: String,
    /// ID of the promotion record, null if promotion was blocked.
    #[serde(rename = "promotion_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub promotion_id: Option<Option<uuid::Uuid>>,
    /// Promotion policy violations detected, empty when none.
    #[serde(rename = "policy_violations")]
    pub policy_violations: Vec<models::PolicyViolation>,
    /// Human-readable status or error message.
    #[serde(rename = "message", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub message: Option<Option<String>>,
}

impl PromotionResponse {
    pub fn new(promoted: bool, source: String, target: String, policy_violations: Vec<models::PolicyViolation>) -> PromotionResponse {
        PromotionResponse {
            promoted,
            source,
            target,
            promotion_id: None,
            policy_violations,
            message: None,
        }
    }
}

