/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.  ## Authentication  The JSON management API under `/api/v1/_*` accepts **API tokens only as `Authorization: Bearer <token>`**. This is the canonical scheme for programmatic access; JWTs issued by the login flow also use `Bearer`. HTTP Basic credentials on `/api/v1/_*` are validated *only* as a real `username:password` login — the password half is **not** retried as an API token. A request to `/api/v1/_*` that sends an API token in the password field of Basic auth therefore returns `401 AUTH_ERROR`; switch to `Authorization: Bearer <token>`.  Format (package-manager) endpoints such as `/v2/_*` (OCI), `/incus/_*`, `/debian/_*`, and the language registries are intentionally more permissive for client compatibility: in addition to Bearer, they accept HTTP **Basic** auth with the API token supplied in the *password* field (any username), matching the `pip` netrc / Artifactory-style `token:<api_token>` convention used by package managers that cannot send a Bearer header. This Basic-with-token fallback applies to format endpoints only, never to `/api/v1/_*`.
 *
 * The version of the OpenAPI document: 1.4.2
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CheckResponse {
    #[serde(rename = "artifact_id")]
    pub artifact_id: uuid::Uuid,
    #[serde(rename = "check_type")]
    pub check_type: String,
    #[serde(rename = "checker_version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub checker_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 = "details", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub details: Option<Option<serde_json::Value>>,
    #[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 = "high_count")]
    pub high_count: i32,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "info_count")]
    pub info_count: i32,
    #[serde(rename = "issues_count")]
    pub issues_count: i32,
    #[serde(rename = "low_count")]
    pub low_count: i32,
    #[serde(rename = "medium_count")]
    pub medium_count: i32,
    #[serde(rename = "passed", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub passed: Option<Option<bool>>,
    #[serde(rename = "repository_id")]
    pub repository_id: uuid::Uuid,
    #[serde(rename = "score", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub score: Option<Option<i32>>,
    #[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 CheckResponse {
    pub fn new(artifact_id: uuid::Uuid, check_type: String, created_at: String, critical_count: i32, high_count: i32, id: uuid::Uuid, info_count: i32, issues_count: i32, low_count: i32, medium_count: i32, repository_id: uuid::Uuid, status: String) -> CheckResponse {
        CheckResponse {
            artifact_id,
            check_type,
            checker_version: None,
            completed_at: None,
            created_at,
            critical_count,
            details: None,
            error_message: None,
            high_count,
            id,
            info_count,
            issues_count,
            low_count,
            medium_count,
            passed: None,
            repository_id,
            score: None,
            started_at: None,
            status,
        }
    }
}

