/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.0.0-rc.3
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ScanResponse {
    #[serde(rename = "artifact_id")]
    pub artifact_id: uuid::Uuid,
    #[serde(rename = "artifact_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub artifact_name: Option<Option<String>>,
    #[serde(rename = "artifact_version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub artifact_version: Option<Option<String>>,
    #[serde(rename = "completed_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub completed_at: Option<Option<String>>,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "critical_count")]
    pub critical_count: i32,
    #[serde(rename = "error_message", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub error_message: Option<Option<String>>,
    #[serde(rename = "findings_count")]
    pub findings_count: i32,
    #[serde(rename = "high_count")]
    pub high_count: i32,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "info_count")]
    pub info_count: i32,
    #[serde(rename = "low_count")]
    pub low_count: i32,
    #[serde(rename = "medium_count")]
    pub medium_count: i32,
    #[serde(rename = "repository_id")]
    pub repository_id: uuid::Uuid,
    #[serde(rename = "scan_type")]
    pub scan_type: String,
    #[serde(rename = "scanner_version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub scanner_version: Option<Option<String>>,
    #[serde(rename = "started_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub started_at: Option<Option<String>>,
    #[serde(rename = "status")]
    pub status: String,
}

impl ScanResponse {
    pub fn new(artifact_id: uuid::Uuid, created_at: String, critical_count: i32, findings_count: i32, high_count: i32, id: uuid::Uuid, info_count: i32, low_count: i32, medium_count: i32, repository_id: uuid::Uuid, scan_type: String, status: String) -> ScanResponse {
        ScanResponse {
            artifact_id,
            artifact_name: None,
            artifact_version: None,
            completed_at: None,
            created_at,
            critical_count,
            error_message: None,
            findings_count,
            high_count,
            id,
            info_count,
            low_count,
            medium_count,
            repository_id,
            scan_type,
            scanner_version: None,
            started_at: None,
            status,
        }
    }
}

