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

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MigrationJobRow {
    #[serde(rename = "completed_items")]
    pub completed_items: i32,
    #[serde(rename = "config")]
    pub config: serde_json::Value,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "created_by", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub created_by: Option<Option<uuid::Uuid>>,
    #[serde(rename = "error_summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub error_summary: Option<Option<String>>,
    #[serde(rename = "failed_items")]
    pub failed_items: i32,
    #[serde(rename = "finished_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub finished_at: Option<Option<String>>,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "job_type")]
    pub job_type: String,
    #[serde(rename = "skipped_items")]
    pub skipped_items: i32,
    #[serde(rename = "source_connection_id")]
    pub source_connection_id: uuid::Uuid,
    #[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 = "total_bytes")]
    pub total_bytes: i64,
    #[serde(rename = "total_items")]
    pub total_items: i32,
    #[serde(rename = "transferred_bytes")]
    pub transferred_bytes: i64,
}

impl MigrationJobRow {
    pub fn new(completed_items: i32, config: serde_json::Value, created_at: String, failed_items: i32, id: uuid::Uuid, job_type: String, skipped_items: i32, source_connection_id: uuid::Uuid, status: String, total_bytes: i64, total_items: i32, transferred_bytes: i64) -> MigrationJobRow {
        MigrationJobRow {
            completed_items,
            config,
            created_at,
            created_by: None,
            error_summary: None,
            failed_items,
            finished_at: None,
            id,
            job_type,
            skipped_items,
            source_connection_id,
            started_at: None,
            status,
            total_bytes,
            total_items,
            transferred_bytes,
        }
    }
}

