use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MigrationJobResponse {
#[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 = "error_summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub error_summary: Option<Option<String>>,
#[serde(rename = "estimated_time_remaining", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub estimated_time_remaining: Option<Option<i64>>,
#[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 = "progress_percent")]
pub progress_percent: f64,
#[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 MigrationJobResponse {
pub fn new(completed_items: i32, config: serde_json::Value, created_at: String, failed_items: i32, id: uuid::Uuid, job_type: String, progress_percent: f64, skipped_items: i32, source_connection_id: uuid::Uuid, status: String, total_bytes: i64, total_items: i32, transferred_bytes: i64) -> MigrationJobResponse {
MigrationJobResponse {
completed_items,
config,
created_at,
error_summary: None,
estimated_time_remaining: None,
failed_items,
finished_at: None,
id,
job_type,
progress_percent,
skipped_items,
source_connection_id,
started_at: None,
status,
total_bytes,
total_items,
transferred_bytes,
}
}
}