use serde::{Deserialize, Serialize};

use crate::state::JobState;

#[derive(Debug, Serialize, Deserialize)]
pub enum Request {
	Status,
	Run(String),
	Pause(String),
	Resume(String),
	Reload,
}

#[derive(Debug, Serialize, Deserialize)]
pub enum Response {
	Status(Vec<JobStatus>),
	Ok(String),
	Error(String),
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct JobStatus {
	pub name: String,
	pub state: JobState,
	pub last_run: Option<String>,
	pub last_exit: Option<i32>,
	pub next_run: Option<String>,
}
