use serde::{Deserialize, Serialize};
use std::{collections::HashMap, path::PathBuf};
#[derive(Debug, Serialize, Deserialize)]
pub struct WorkPackage {
pub binary: Vec<u8>,
pub path: PathBuf,
pub cwd: Option<PathBuf>,
#[serde(default)]
pub args: Vec<String>,
#[serde(default)]
pub env: HashMap<String, String>,
#[serde(default)]
pub pre: Vec<String>,
#[serde(default)]
pub post: Vec<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(tag = "status", rename_all = "snake_case")]
pub enum ServerMessage {
Ok {
#[serde(skip_serializing_if = "Option::is_none")]
data: Option<serde_json::Value>,
},
ExecutionFinished {
stdout: String,
stderr: String,
},
Error {
msg: String,
},
}