/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.  ## Authentication  The JSON management API under `/api/v1/_*` accepts **API tokens only as `Authorization: Bearer <token>`**. This is the canonical scheme for programmatic access; JWTs issued by the login flow also use `Bearer`. HTTP Basic credentials on `/api/v1/_*` are validated *only* as a real `username:password` login — the password half is **not** retried as an API token. A request to `/api/v1/_*` that sends an API token in the password field of Basic auth therefore returns `401 AUTH_ERROR`; switch to `Authorization: Bearer <token>`.  Format (package-manager) endpoints such as `/v2/_*` (OCI), `/incus/_*`, `/debian/_*`, and the language registries are intentionally more permissive for client compatibility: in addition to Bearer, they accept HTTP **Basic** auth with the API token supplied in the *password* field (any username), matching the `pip` netrc / Artifactory-style `token:<api_token>` convention used by package managers that cannot send a Bearer header. This Basic-with-token fallback applies to format endpoints only, never to `/api/v1/_*`.
 *
 * The version of the OpenAPI document: 1.3.0
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MigrationItemResponse {
    #[serde(rename = "checksum_source", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub checksum_source: Option<Option<String>>,
    #[serde(rename = "checksum_target", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub checksum_target: Option<Option<String>>,
    #[serde(rename = "completed_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub completed_at: Option<Option<String>>,
    #[serde(rename = "error_message", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub error_message: Option<Option<String>>,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "item_type")]
    pub item_type: String,
    #[serde(rename = "job_id")]
    pub job_id: uuid::Uuid,
    #[serde(rename = "retry_count")]
    pub retry_count: i32,
    #[serde(rename = "size_bytes")]
    pub size_bytes: i64,
    #[serde(rename = "source_path")]
    pub source_path: String,
    #[serde(rename = "started_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub started_at: Option<Option<String>>,
    #[serde(rename = "status")]
    pub status: String,
    #[serde(rename = "target_path", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub target_path: Option<Option<String>>,
}

impl MigrationItemResponse {
    pub fn new(id: uuid::Uuid, item_type: String, job_id: uuid::Uuid, retry_count: i32, size_bytes: i64, source_path: String, status: String) -> MigrationItemResponse {
        MigrationItemResponse {
            checksum_source: None,
            checksum_target: None,
            completed_at: None,
            error_message: None,
            id,
            item_type,
            job_id,
            retry_count,
            size_bytes,
            source_path,
            started_at: None,
            status,
            target_path: None,
        }
    }
}

