use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MigrationItemRow {
#[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 = "metadata")]
pub metadata: serde_json::Value,
#[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 MigrationItemRow {
pub fn new(id: uuid::Uuid, item_type: String, job_id: uuid::Uuid, metadata: serde_json::Value, retry_count: i32, size_bytes: i64, source_path: String, status: String) -> MigrationItemRow {
MigrationItemRow {
checksum_source: None,
checksum_target: None,
completed_at: None,
error_message: None,
id,
item_type,
job_id,
metadata,
retry_count,
size_bytes,
source_path,
started_at: None,
status,
target_path: None,
}
}
}