/*
 * 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 PromotionHistoryEntry {
    #[serde(rename = "artifact_id")]
    pub artifact_id: uuid::Uuid,
    #[serde(rename = "artifact_path")]
    pub artifact_path: String,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "notes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub notes: Option<Option<String>>,
    #[serde(rename = "policy_result", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub policy_result: Option<Option<serde_json::Value>>,
    #[serde(rename = "promoted_by", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub promoted_by: Option<Option<uuid::Uuid>>,
    #[serde(rename = "promoted_by_username", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub promoted_by_username: Option<Option<String>>,
    #[serde(rename = "rejection_reason", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub rejection_reason: Option<Option<String>>,
    #[serde(rename = "source_repo_key")]
    pub source_repo_key: String,
    #[serde(rename = "status")]
    pub status: String,
    #[serde(rename = "target_repo_key")]
    pub target_repo_key: String,
}

impl PromotionHistoryEntry {
    pub fn new(artifact_id: uuid::Uuid, artifact_path: String, created_at: String, id: uuid::Uuid, source_repo_key: String, status: String, target_repo_key: String) -> PromotionHistoryEntry {
        PromotionHistoryEntry {
            artifact_id,
            artifact_path,
            created_at,
            id,
            notes: None,
            policy_result: None,
            promoted_by: None,
            promoted_by_username: None,
            rejection_reason: None,
            source_repo_key,
            status,
            target_repo_key,
        }
    }
}

