/*
 * 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 Finding {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "scan_id")]
    pub scan_id: uuid::Uuid,
    /// CVE identifier
    #[serde(rename = "vulnerability_id")]
    pub vulnerability_id: String,
    #[serde(rename = "severity")]
    pub severity: Severity,
    #[serde(rename = "package_name")]
    pub package_name: String,
    #[serde(rename = "installed_version")]
    pub installed_version: String,
    #[serde(rename = "fixed_version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub fixed_version: Option<Option<String>>,
    #[serde(rename = "title")]
    pub title: String,
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    #[serde(rename = "acknowledged")]
    pub acknowledged: bool,
    #[serde(rename = "acknowledged_by", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub acknowledged_by: Option<Option<uuid::Uuid>>,
    #[serde(rename = "acknowledged_reason", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub acknowledged_reason: Option<Option<String>>,
}

impl Finding {
    pub fn new(id: uuid::Uuid, scan_id: uuid::Uuid, vulnerability_id: String, severity: Severity, package_name: String, installed_version: String, title: String, acknowledged: bool) -> Finding {
        Finding {
            id,
            scan_id,
            vulnerability_id,
            severity,
            package_name,
            installed_version,
            fixed_version: None,
            title,
            description: None,
            acknowledged,
            acknowledged_by: None,
            acknowledged_reason: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Severity {
    #[serde(rename = "critical")]
    Critical,
    #[serde(rename = "high")]
    High,
    #[serde(rename = "medium")]
    Medium,
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "negligible")]
    Negligible,
}

impl Default for Severity {
    fn default() -> Severity {
        Self::Critical
    }
}

