/*
 * 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 SecurityScore {
    #[serde(rename = "repository_id")]
    pub repository_id: uuid::Uuid,
    #[serde(rename = "repository_key")]
    pub repository_key: String,
    #[serde(rename = "score")]
    pub score: Score,
    #[serde(rename = "critical_count")]
    pub critical_count: i32,
    #[serde(rename = "high_count")]
    pub high_count: i32,
    #[serde(rename = "medium_count")]
    pub medium_count: i32,
    #[serde(rename = "low_count")]
    pub low_count: i32,
    #[serde(rename = "last_scanned_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub last_scanned_at: Option<Option<String>>,
}

impl SecurityScore {
    pub fn new(repository_id: uuid::Uuid, repository_key: String, score: Score, critical_count: i32, high_count: i32, medium_count: i32, low_count: i32) -> SecurityScore {
        SecurityScore {
            repository_id,
            repository_key,
            score,
            critical_count,
            high_count,
            medium_count,
            low_count,
            last_scanned_at: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Score {
    #[serde(rename = "A")]
    A,
    #[serde(rename = "B")]
    B,
    #[serde(rename = "C")]
    C,
    #[serde(rename = "D")]
    D,
    #[serde(rename = "F")]
    F,
}

impl Default for Score {
    fn default() -> Score {
        Self::A
    }
}

