Files
voltsrage 24f45851e9
CI / frontend (push) Canceled after 0s
CI / backend (push) Canceled after 8m32s
feature: In-App Simulation Runner (Backend)
2026-08-06 01:52:53 +08:00

25 lines
1005 B
C#

public enum SimulationRunStatus { Pending, Running, Completed, Cancelled, Failed }
public static class SimulationRunStatusExtensions
{
public static string ToDbString(this SimulationRunStatus s) => s switch
{
SimulationRunStatus.Pending => "PENDING",
SimulationRunStatus.Running => "RUNNING",
SimulationRunStatus.Completed => "COMPLETED",
SimulationRunStatus.Cancelled => "CANCELLED",
SimulationRunStatus.Failed => "FAILED",
_ => throw new ArgumentOutOfRangeException(nameof(s))
};
public static SimulationRunStatus FromDbString(string v) => v switch
{
"PENDING" => SimulationRunStatus.Pending,
"RUNNING" => SimulationRunStatus.Running,
"COMPLETED" => SimulationRunStatus.Completed,
"CANCELLED" => SimulationRunStatus.Cancelled,
"FAILED" => SimulationRunStatus.Failed,
_ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown simulation run status: '{v}'")
};
}