use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use ts_rs::TS;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema, TS)]
#[serde(rename_all = "lowercase")]
pub enum RuntimeType {
Direct,
Docker,
Podman,
}
impl std::fmt::Display for RuntimeType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
RuntimeType::Direct => write!(f, "direct"),
RuntimeType::Docker => write!(f, "docker"),
RuntimeType::Podman => write!(f, "podman"),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, TS)]
pub struct Runtime {
pub r#type: RuntimeType,
#[serde(default)]
#[ts(optional=nullable)]
pub image: Option<String>,
#[serde(default)]
#[ts(optional=nullable)]
pub working_dir: Option<String>,
#[serde(default)]
#[ts(optional=nullable)]
pub user: Option<String>,
#[serde(default)]
#[ts(optional=nullable)]
pub network: Option<String>,
#[serde(default)]
#[ts(optional=nullable)]
pub options: Option<Vec<String>>,
}