use chrono::{DateTime, Utc};
use serde::Serialize;
use uuid::Uuid;
use ironflow_store::entities::WorkflowPause;
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
#[derive(Debug, Serialize)]
pub struct WorkflowPauseResponse {
pub workflow_name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub paused_at: Option<DateTime<Utc>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub paused_by: Option<Uuid>,
}
impl WorkflowPauseResponse {
pub fn resumed(workflow_name: &str) -> Self {
Self {
workflow_name: workflow_name.to_string(),
paused_at: None,
paused_by: None,
}
}
}
impl From<WorkflowPause> for WorkflowPauseResponse {
fn from(pause: WorkflowPause) -> Self {
Self {
workflow_name: pause.workflow_name,
paused_at: Some(pause.paused_at),
paused_by: pause.paused_by,
}
}
}