/*
 * 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};

/// RepositoryStorageBreakdown : Storage usage breakdown for a single repository.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RepositoryStorageBreakdown {
    /// Unique identifier of the repository.
    #[serde(rename = "repository_id")]
    pub repository_id: uuid::Uuid,
    /// URL-safe key of the repository.
    #[serde(rename = "repository_key")]
    pub repository_key: String,
    /// Human-readable name of the repository.
    #[serde(rename = "repository_name")]
    pub repository_name: String,
    /// Package format handled by this repository.
    #[serde(rename = "format")]
    pub format: String,
    /// Number of artifacts stored in this repository.
    #[serde(rename = "artifact_count")]
    pub artifact_count: i32,
    /// Total storage consumed by this repository in bytes.
    #[serde(rename = "storage_bytes")]
    pub storage_bytes: i64,
    /// Total download count for artifacts in this repository.
    #[serde(rename = "download_count")]
    pub download_count: i64,
    /// Timestamp of the most recent artifact upload, or null if no artifacts have been uploaded.
    #[serde(rename = "last_upload_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub last_upload_at: Option<Option<String>>,
}

impl RepositoryStorageBreakdown {
    /// Storage usage breakdown for a single repository.
    pub fn new(repository_id: uuid::Uuid, repository_key: String, repository_name: String, format: String, artifact_count: i32, storage_bytes: i64, download_count: i64) -> RepositoryStorageBreakdown {
        RepositoryStorageBreakdown {
            repository_id,
            repository_key,
            repository_name,
            format,
            artifact_count,
            storage_bytes,
            download_count,
            last_upload_at: None,
        }
    }
}

