| | | 1 | | using System.ComponentModel; |
| | | 2 | | using Spectre.Console; |
| | | 3 | | using Spectre.Console.Cli; |
| | | 4 | | |
| | | 5 | | namespace Orchestrator.Commands.Observability.ExportExperimentDataset; |
| | | 6 | | |
| | | 7 | | public sealed class ExportExperimentDatasetSettings : CommandSettings |
| | | 8 | | { |
| | | 9 | | [CommandOption("--community-context")] |
| | | 10 | | [Description("Community context used to scope persisted match outcomes")] |
| | 0 | 11 | | public string CommunityContext { get; set; } = string.Empty; |
| | | 12 | | |
| | | 13 | | [CommandOption("--matchdays")] |
| | | 14 | | [Description("Optional comma-separated list of matchdays to export. Defaults to all Bundesliga matchdays.")] |
| | 0 | 15 | | public string? Matchdays { get; set; } |
| | | 16 | | |
| | | 17 | | [CommandOption("--output")] |
| | | 18 | | [Description("Path to the JSON file to write. Defaults to artifacts/langfuse-dataset/<community>.json")] |
| | 0 | 19 | | public string? OutputPath { get; set; } |
| | | 20 | | |
| | | 21 | | public override ValidationResult Validate() |
| | | 22 | | { |
| | 0 | 23 | | if (string.IsNullOrWhiteSpace(CommunityContext)) |
| | | 24 | | { |
| | 0 | 25 | | return ValidationResult.Error("--community-context is required"); |
| | | 26 | | } |
| | | 27 | | |
| | 0 | 28 | | if (string.IsNullOrWhiteSpace(Matchdays)) |
| | | 29 | | { |
| | 0 | 30 | | return ValidationResult.Success(); |
| | | 31 | | } |
| | | 32 | | |
| | 0 | 33 | | var segments = Matchdays.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); |
| | 0 | 34 | | if (segments.Length == 0) |
| | | 35 | | { |
| | 0 | 36 | | return ValidationResult.Error("--matchdays must contain at least one matchday number when provided"); |
| | | 37 | | } |
| | | 38 | | |
| | 0 | 39 | | foreach (var segment in segments) |
| | | 40 | | { |
| | 0 | 41 | | if (!int.TryParse(segment, out var matchday) || matchday is < 1 or > 34) |
| | | 42 | | { |
| | 0 | 43 | | return ValidationResult.Error($"Invalid matchday '{segment}'. Expected an integer between 1 and 34."); |
| | | 44 | | } |
| | | 45 | | } |
| | | 46 | | |
| | 0 | 47 | | return ValidationResult.Success(); |
| | | 48 | | } |
| | | 49 | | } |