namespace ClaudeDo.Data.Models;

public sealed class TaskRunEntity
{
    public required string Id { get; init; }
    public required string TaskId { get; init; }
    public required int RunNumber { get; init; }
    public string? SessionId { get; set; }
    public required bool IsRetry { get; init; }
    public required string Prompt { get; init; }
    public string? ResultMarkdown { get; set; }
    public string? StructuredOutputJson { get; set; }
    public string? ErrorMarkdown { get; set; }
    public int? ExitCode { get; set; }
    public int? TurnCount { get; set; }
    public int? TokensIn { get; set; }
    public int? TokensOut { get; set; }
    public int? CacheReadTokens { get; set; }
    public int? CacheWriteTokens { get; set; }
    public string? LogPath { get; set; }
    public DateTime? StartedAt { get; set; }
    public DateTime? FinishedAt { get; set; }
    public string? Model { get; set; }
    // Raw diagnostics from the CLI's stream-json result event (StreamAnalyzer), kept verbatim
    // for get_run/get_task_log — TaskEntity.FailureReason is the classified, MCP-facing summary.
    public string? ResultSubtype { get; set; }
    public string? TerminalReason { get; set; }
    public string? Errors { get; set; }

    // Navigation property
    public TaskEntity Task { get; set; } = null!;
}
