/*
 * 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};

/// PolicyExecutionResult : Outcome of a lifecycle policy execution or dry-run preview.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PolicyExecutionResult {
    /// Identifier of the executed lifecycle policy.
    #[serde(rename = "policy_id")]
    pub policy_id: uuid::Uuid,
    /// Name of the executed lifecycle policy.
    #[serde(rename = "policy_name")]
    pub policy_name: String,
    /// Whether this was a preview (true) or a real execution (false).
    #[serde(rename = "dry_run")]
    pub dry_run: bool,
    /// Number of artifacts that matched the policy criteria.
    #[serde(rename = "artifacts_matched")]
    pub artifacts_matched: i32,
    /// Number of artifacts actually removed. Zero for dry-run previews.
    #[serde(rename = "artifacts_removed")]
    pub artifacts_removed: i32,
    /// Total storage bytes reclaimed by the execution. Zero for dry-run previews.
    #[serde(rename = "bytes_freed")]
    pub bytes_freed: i32,
    /// List of errors encountered during execution.
    #[serde(rename = "errors")]
    pub errors: Vec<String>,
}

impl PolicyExecutionResult {
    /// Outcome of a lifecycle policy execution or dry-run preview.
    pub fn new(policy_id: uuid::Uuid, policy_name: String, dry_run: bool, artifacts_matched: i32, artifacts_removed: i32, bytes_freed: i32, errors: Vec<String>) -> PolicyExecutionResult {
        PolicyExecutionResult {
            policy_id,
            policy_name,
            dry_run,
            artifacts_matched,
            artifacts_removed,
            bytes_freed,
            errors,
        }
    }
}

