Files
BQP/srcs/RobotNet10/Shared/RobotNet10.NavigationTune.Shared/Models/TestRun.cs
2026-07-13 09:25:40 +07:00

98 lines
2.7 KiB
C#

namespace RobotNet10.NavigationTune.Shared.Models;
/// <summary>
/// Test run execution record
/// </summary>
public class TestRun
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid ScenarioId { get; set; }
public Guid ParameterSetId { get; set; }
public DateTime StartTime { get; set; }
public DateTime? EndTime { get; set; }
public TestStatus Status { get; set; }
public double Duration { get; set; } // seconds
public string? Notes { get; set; }
public string? ErrorMessage { get; set; }
// Navigation properties
public TestScenario? Scenario { get; set; }
public NavigationParameterSet? ParameterSet { get; set; }
public TestMetrics? Metrics { get; set; }
public List<SafetyViolation> SafetyViolations { get; set; } = new();
}
/// <summary>
/// DTO for TestRun API responses. Use this to avoid deserializing abstract TestScenario on the client.
/// </summary>
public class TestRunDto
{
public Guid Id { get; set; }
public Guid ScenarioId { get; set; }
public string ScenarioName { get; set; } = string.Empty;
public Guid ParameterSetId { get; set; }
public string ParameterSetName { get; set; } = string.Empty;
public DateTime StartTime { get; set; }
public DateTime? EndTime { get; set; }
public TestStatus Status { get; set; }
public double Duration { get; set; }
public string? Notes { get; set; }
public string? ErrorMessage { get; set; }
public TestMetrics? Metrics { get; set; }
public List<SafetyViolation> SafetyViolations { get; set; } = new();
}
/// <summary>
/// Request body for delete-batch API
/// </summary>
public class DeleteBatchRequest
{
public List<Guid> Ids { get; set; } = new();
}
/// <summary>
/// Test execution status
/// </summary>
public enum TestStatus
{
Preparing = 0,
Running = 1,
Paused = 2,
Completed = 3,
Aborted = 4,
Error = 5,
EmergencyStopped = 6
}
/// <summary>
/// Safety violation during test
/// </summary>
public class SafetyViolation
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid TestRunId { get; set; }
public DateTime Timestamp { get; set; }
public ViolationType Type { get; set; }
public ViolationSeverity Severity { get; set; }
public double Value { get; set; }
public double Threshold { get; set; }
public string Message { get; set; } = string.Empty;
}
public enum ViolationType
{
CrossTrackError = 1,
HeadingError = 2,
VelocityLimit = 3,
AccelerationLimit = 4,
SustainedTrackingError = 5,
ObstacleProximity = 6
}
public enum ViolationSeverity
{
Info = 0,
Warning = 1,
Critical = 2
}