/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.2.1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// MavenComponentResponse : A Maven component grouped by GAV (groupId, artifactId, version).  Each component collects the individual files (jar, pom, checksums, etc.) that share the same Maven coordinates.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MavenComponentResponse {
    /// Individual filenames belonging to this component.
    #[serde(rename = "artifact_files")]
    pub artifact_files: Vec<String>,
    /// Maven artifactId (e.g. `junit-jupiter-api`).
    #[serde(rename = "artifact_id")]
    pub artifact_id: String,
    /// Earliest creation timestamp among the component files.
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// Total download count across all files in this component.
    #[serde(rename = "download_count")]
    pub download_count: i64,
    /// Repository format (always `maven` or `gradle`).
    #[serde(rename = "format")]
    pub format: String,
    /// Maven groupId with dots (e.g. `org.junit.jupiter`).
    #[serde(rename = "group_id")]
    pub group_id: String,
    /// Representative artifact ID (the first file in the group).
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// Repository key this component belongs to.
    #[serde(rename = "repository_key")]
    pub repository_key: String,
    /// Total size in bytes across all files in this component.
    #[serde(rename = "size_bytes")]
    pub size_bytes: i64,
    /// Maven version string (e.g. `5.11.0`).
    #[serde(rename = "version")]
    pub version: String,
}

impl MavenComponentResponse {
    /// A Maven component grouped by GAV (groupId, artifactId, version).  Each component collects the individual files (jar, pom, checksums, etc.) that share the same Maven coordinates.
    pub fn new(artifact_files: Vec<String>, artifact_id: String, created_at: String, download_count: i64, format: String, group_id: String, id: uuid::Uuid, repository_key: String, size_bytes: i64, version: String) -> MavenComponentResponse {
        MavenComponentResponse {
            artifact_files,
            artifact_id,
            created_at,
            download_count,
            format,
            group_id,
            id,
            repository_key,
            size_bytes,
            version,
        }
    }
}

