/*
 * 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 MigrationJob {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "connection_id")]
    pub connection_id: uuid::Uuid,
    #[serde(rename = "status")]
    pub status: Status,
    #[serde(rename = "source_repos")]
    pub source_repos: Vec<String>,
    #[serde(rename = "target_repos")]
    pub target_repos: Vec<String>,
    #[serde(rename = "total_items")]
    pub total_items: i32,
    #[serde(rename = "completed_items")]
    pub completed_items: i32,
    #[serde(rename = "failed_items")]
    pub failed_items: i32,
    #[serde(rename = "skipped_items")]
    pub skipped_items: i32,
    #[serde(rename = "options")]
    pub options: serde_json::Value,
    #[serde(rename = "created_at")]
    pub created_at: 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 = "completed_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub completed_at: Option<Option<String>>,
}

impl MigrationJob {
    pub fn new(id: uuid::Uuid, connection_id: uuid::Uuid, status: Status, source_repos: Vec<String>, target_repos: Vec<String>, total_items: i32, completed_items: i32, failed_items: i32, skipped_items: i32, options: serde_json::Value, created_at: String) -> MigrationJob {
        MigrationJob {
            id,
            connection_id,
            status,
            source_repos,
            target_repos,
            total_items,
            completed_items,
            failed_items,
            skipped_items,
            options,
            created_at,
            started_at: None,
            completed_at: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "pending")]
    Pending,
    #[serde(rename = "running")]
    Running,
    #[serde(rename = "paused")]
    Paused,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "failed")]
    Failed,
    #[serde(rename = "cancelled")]
    Cancelled,
}

impl Default for Status {
    fn default() -> Status {
        Self::Pending
    }
}

