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

/// RepositorySnapshot : A point-in-time snapshot of metrics for a single repository.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RepositorySnapshot {
    /// Unique identifier of the repository.
    #[serde(rename = "repository_id")]
    pub repository_id: uuid::Uuid,
    /// Human-readable name of the repository, or null if the repository has been deleted.
    #[serde(rename = "repository_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub repository_name: Option<Option<String>>,
    /// URL-safe key of the repository, or null if the repository has been deleted.
    #[serde(rename = "repository_key", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub repository_key: Option<Option<String>>,
    /// The date this snapshot was captured (YYYY-MM-DD).
    #[serde(rename = "snapshot_date")]
    pub snapshot_date: String,
    /// Number of artifacts in the repository at the time of the snapshot.
    #[serde(rename = "artifact_count")]
    pub artifact_count: i32,
    /// Storage consumed by the repository in bytes.
    #[serde(rename = "storage_bytes")]
    pub storage_bytes: i64,
    /// Cumulative download count for the repository.
    #[serde(rename = "download_count")]
    pub download_count: i64,
}

impl RepositorySnapshot {
    /// A point-in-time snapshot of metrics for a single repository.
    pub fn new(repository_id: uuid::Uuid, snapshot_date: String, artifact_count: i32, storage_bytes: i64, download_count: i64) -> RepositorySnapshot {
        RepositorySnapshot {
            repository_id,
            repository_name: None,
            repository_key: None,
            snapshot_date,
            artifact_count,
            storage_bytes,
            download_count,
        }
    }
}

