/*
 * 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 Artifact {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "repository_id")]
    pub repository_id: uuid::Uuid,
    #[serde(rename = "repository_key")]
    pub repository_key: String,
    #[serde(rename = "path")]
    pub path: String,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub version: Option<Option<String>>,
    #[serde(rename = "format")]
    pub format: String,
    #[serde(rename = "size_bytes")]
    pub size_bytes: i32,
    #[serde(rename = "sha256")]
    pub sha256: String,
    #[serde(rename = "content_type")]
    pub content_type: String,
    #[serde(rename = "download_count")]
    pub download_count: i32,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
}

impl Artifact {
    pub fn new(id: uuid::Uuid, repository_id: uuid::Uuid, repository_key: String, path: String, name: String, format: String, size_bytes: i32, sha256: String, content_type: String, download_count: i32, created_at: String, updated_at: String) -> Artifact {
        Artifact {
            id,
            repository_id,
            repository_key,
            path,
            name,
            version: None,
            format,
            size_bytes,
            sha256,
            content_type,
            download_count,
            created_at,
            updated_at,
        }
    }
}

