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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Package {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "repository_id")]
    pub repository_id: uuid::Uuid,
    #[serde(rename = "repository_key")]
    pub repository_key: String,
    #[serde(rename = "format")]
    pub format: String,
    #[serde(rename = "latest_version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub latest_version: Option<Option<String>>,
    #[serde(rename = "version_count")]
    pub version_count: i32,
    #[serde(rename = "total_downloads")]
    pub total_downloads: i32,
    #[serde(rename = "created_at")]
    pub created_at: String,
}

impl Package {
    pub fn new(id: uuid::Uuid, name: String, repository_id: uuid::Uuid, repository_key: String, format: String, version_count: i32, total_downloads: i32, created_at: String) -> Package {
        Package {
            id,
            name,
            repository_id,
            repository_key,
            format,
            latest_version: None,
            version_count,
            total_downloads,
            created_at,
        }
    }
}

