namespace ClawdDotNet.Core.Tasks; /// /// Übersetzt die Aufzählungen in ihre menschenlesbare Form und zurück. Dieselbe /// Schreibweise wird im Frontmatter wie in der DB verwendet, damit beide Seiten sich /// nicht auseinanderentwickeln. Unbekannte Eingaben fallen auf einen sicheren Standard /// zurück, statt zu werfen — eine von Hand editierte Datei soll das Board nicht kippen. /// public static class TaskText { public static string Of(TaskItemStatus status) => status switch { TaskItemStatus.Backlog => "backlog", TaskItemStatus.Todo => "todo", TaskItemStatus.InProgress => "in_progress", TaskItemStatus.InReview => "in_review", TaskItemStatus.Done => "done", TaskItemStatus.Canceled => "canceled", TaskItemStatus.Blocked => "blocked", TaskItemStatus.Archived => "archived", _ => "todo" }; public static TaskItemStatus Status(string? value) => value?.Trim().ToLowerInvariant() switch { "backlog" => TaskItemStatus.Backlog, "todo" => TaskItemStatus.Todo, "in_progress" => TaskItemStatus.InProgress, "in_review" => TaskItemStatus.InReview, "done" => TaskItemStatus.Done, "canceled" or "cancelled" => TaskItemStatus.Canceled, "blocked" => TaskItemStatus.Blocked, "archived" => TaskItemStatus.Archived, _ => TaskItemStatus.Todo }; public static string Of(TaskItemType type) => type switch { TaskItemType.Work => "work", TaskItemType.Approval => "approval", TaskItemType.HumanInput => "human_input", TaskItemType.ToolJob => "tool_job", TaskItemType.Meeting => "meeting", _ => "work" }; public static TaskItemType Type(string? value) => value?.Trim().ToLowerInvariant() switch { "approval" => TaskItemType.Approval, "human_input" => TaskItemType.HumanInput, "tool_job" => TaskItemType.ToolJob, "meeting" => TaskItemType.Meeting, _ => TaskItemType.Work }; public static string Of(TaskWhenKind kind) => kind switch { TaskWhenKind.At => "at", TaskWhenKind.Every => "every", TaskWhenKind.Cron => "cron", _ => "cron" }; /// Gibt null zurück, wenn die Angabe keine bekannte Terminart ist. public static TaskWhenKind? WhenKind(string? value) => value?.Trim().ToLowerInvariant() switch { "at" => TaskWhenKind.At, "every" => TaskWhenKind.Every, "cron" => TaskWhenKind.Cron, _ => null }; }