use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Schedule {
#[serde(rename = "id")]
pub id: uuid::Uuid,
#[serde(rename = "identifier", deserialize_with = "Option::deserialize")]
pub identifier: Option<String>,
#[serde(rename = "uid")]
pub uid: String,
#[serde(rename = "actor_name")]
pub actor_name: String,
#[serde(rename = "rel_obj_app_label")]
pub rel_obj_app_label: String,
#[serde(rename = "rel_obj_model")]
pub rel_obj_model: String,
#[serde(
rename = "rel_obj_id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub rel_obj_id: Option<Option<String>>,
#[serde(rename = "crontab")]
pub crontab: String,
#[serde(rename = "paused", skip_serializing_if = "Option::is_none")]
pub paused: Option<bool>,
#[serde(rename = "next_run")]
pub next_run: String,
#[serde(rename = "description", deserialize_with = "Option::deserialize")]
pub description: Option<String>,
#[serde(rename = "last_task_status", deserialize_with = "Option::deserialize")]
pub last_task_status: Option<models::LastTaskStatusEnum>,
}
impl Schedule {
pub fn new(
id: uuid::Uuid,
identifier: Option<String>,
uid: String,
actor_name: String,
rel_obj_app_label: String,
rel_obj_model: String,
crontab: String,
next_run: String,
description: Option<String>,
last_task_status: Option<models::LastTaskStatusEnum>,
) -> Schedule {
Schedule {
id,
identifier,
uid,
actor_name,
rel_obj_app_label,
rel_obj_model,
rel_obj_id: None,
crontab,
paused: None,
next_run,
description,
last_task_status,
}
}
}