use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct JobStatusResponse {
#[serde(rename = "attempts")]
pub attempts: i32,
#[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 = "created_at")]
pub created_at: 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: String,
#[serde(rename = "job_type")]
pub job_type: models::JobType,
#[serde(
rename = "result",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub result: Option<Option<Box<models::JobResult>>>,
#[serde(rename = "status")]
pub status: models::JobStatus,
}
impl JobStatusResponse {
pub fn new(
attempts: i32,
created_at: String,
id: String,
job_type: models::JobType,
status: models::JobStatus,
) -> JobStatusResponse {
JobStatusResponse {
attempts,
completed_at: None,
created_at,
error_message: None,
id,
job_type,
result: None,
status,
}
}
}