/*
 * 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 DtVulnerability {
    /// Vulnerability UUID
    #[serde(rename = "uuid")]
    pub uuid: String,
    /// Vulnerability identifier (e.g. CVE-2024-12345)
    #[serde(rename = "vuln_id")]
    pub vuln_id: String,
    /// Vulnerability data source (e.g. NVD, GITHUB, OSV)
    #[serde(rename = "source")]
    pub source: String,
    /// Severity level (CRITICAL, HIGH, MEDIUM, LOW, INFO, UNASSIGNED)
    #[serde(rename = "severity")]
    pub severity: String,
    /// Short title of the vulnerability
    #[serde(rename = "title", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub title: Option<Option<String>>,
    /// Detailed description of the vulnerability
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    /// CVSS v3 base score (0.0 to 10.0)
    #[serde(rename = "cvss_v3_base_score", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub cvss_v3_base_score: Option<Option<f64>>,
    #[serde(rename = "cwe", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub cwe: Option<Option<Box<models::DtCwe>>>,
}

impl DtVulnerability {
    pub fn new(uuid: String, vuln_id: String, source: String, severity: String) -> DtVulnerability {
        DtVulnerability {
            uuid,
            vuln_id,
            source,
            severity,
            title: None,
            description: None,
            cvss_v3_base_score: None,
            cwe: None,
        }
    }
}

