1use serde::{Deserialize, Serialize};
2
3use crate::{Run, Sandbox, SandboxCommand, SandboxId, SandboxSpec};
4
5#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
10#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
11#[cfg_attr(feature = "typescript", ts(export_to = "controller-api.ts"))]
12pub struct Execution {
13 pub id: SandboxId,
14 pub owner: Option<String>,
17 pub spec: SandboxSpec,
18 pub run: Run,
19 pub commands: Vec<SandboxCommand>,
21 pub replays: Vec<Run>,
23}
24
25impl Execution {
26 pub fn of(sandbox: Sandbox, commands: Vec<SandboxCommand>) -> Self {
28 Self {
29 id: sandbox.id,
30 owner: sandbox.owner,
31 spec: sandbox.spec,
32 run: sandbox.run,
33 commands,
34 replays: sandbox.replays,
35 }
36 }
37}