/*
 * 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 RepoHealthResponse {
    #[serde(rename = "artifacts_evaluated")]
    pub artifacts_evaluated: i32,
    #[serde(rename = "artifacts_failing")]
    pub artifacts_failing: i32,
    #[serde(rename = "artifacts_passing")]
    pub artifacts_passing: i32,
    #[serde(rename = "avg_license_score", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub avg_license_score: Option<Option<i32>>,
    #[serde(rename = "avg_metadata_score", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub avg_metadata_score: Option<Option<i32>>,
    #[serde(rename = "avg_quality_score", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub avg_quality_score: Option<Option<i32>>,
    #[serde(rename = "avg_security_score", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub avg_security_score: Option<Option<i32>>,
    #[serde(rename = "health_grade")]
    pub health_grade: String,
    #[serde(rename = "health_score")]
    pub health_score: i32,
    #[serde(rename = "last_evaluated_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub last_evaluated_at: Option<Option<String>>,
    #[serde(rename = "repository_id")]
    pub repository_id: uuid::Uuid,
    #[serde(rename = "repository_key")]
    pub repository_key: String,
}

impl RepoHealthResponse {
    pub fn new(artifacts_evaluated: i32, artifacts_failing: i32, artifacts_passing: i32, health_grade: String, health_score: i32, repository_id: uuid::Uuid, repository_key: String) -> RepoHealthResponse {
        RepoHealthResponse {
            artifacts_evaluated,
            artifacts_failing,
            artifacts_passing,
            avg_license_score: None,
            avg_metadata_score: None,
            avg_quality_score: None,
            avg_security_score: None,
            health_grade,
            health_score,
            last_evaluated_at: None,
            repository_id,
            repository_key,
        }
    }
}

