/*
 * 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 DtPolicyFull {
    /// Policy UUID
    #[serde(rename = "uuid")]
    pub uuid: String,
    /// Policy name
    #[serde(rename = "name")]
    pub name: String,
    /// Violation state (e.g. FAIL, WARN, INFO)
    #[serde(rename = "violation_state")]
    pub violation_state: String,
    /// Whether the policy applies to child projects
    #[serde(rename = "include_children", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub include_children: Option<Option<bool>>,
    /// Conditions that trigger this policy
    #[serde(rename = "policy_conditions")]
    pub policy_conditions: Vec<models::DtPolicyConditionFull>,
    /// Projects this policy is applied to
    #[serde(rename = "projects")]
    pub projects: Vec<models::DtProject>,
    /// Tags associated with this policy
    #[serde(rename = "tags")]
    pub tags: Vec<serde_json::Value>,
}

impl DtPolicyFull {
    pub fn new(uuid: String, name: String, violation_state: String, policy_conditions: Vec<models::DtPolicyConditionFull>, projects: Vec<models::DtProject>, tags: Vec<serde_json::Value>) -> DtPolicyFull {
        DtPolicyFull {
            uuid,
            name,
            violation_state,
            include_children: None,
            policy_conditions,
            projects,
            tags,
        }
    }
}

