use serde::{Deserialize, Serialize};
use crate::{Run, Sandbox, SandboxCommand, SandboxId, SandboxSpec};
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export_to = "controller-api.ts"))]
pub struct Execution {
pub id: SandboxId,
pub owner: Option<String>,
pub spec: SandboxSpec,
pub run: Run,
pub commands: Vec<SandboxCommand>,
pub replays: Vec<Run>,
}
impl Execution {
pub fn of(sandbox: Sandbox, commands: Vec<SandboxCommand>) -> Self {
Self {
id: sandbox.id,
owner: sandbox.owner,
spec: sandbox.spec,
run: sandbox.run,
commands,
replays: sandbox.replays,
}
}
}