using System.Text.Json.Serialization;

namespace ClawdDotNet.App.Models;

public sealed class TokenUsageRecord
{
    [JsonPropertyName("timestamp")]
    public DateTime Timestamp { get; set; } = DateTime.Now;

    [JsonPropertyName("agentId")]
    public string AgentId { get; set; } = "";

    [JsonPropertyName("agentName")]
    public string AgentName { get; set; } = "";

    [JsonPropertyName("model")]
    public string Model { get; set; } = "";

    [JsonPropertyName("promptTokens")]
    public int PromptTokens { get; set; }

    [JsonPropertyName("completionTokens")]
    public int CompletionTokens { get; set; }

    [JsonPropertyName("totalTokens")]
    public int TotalTokens { get; set; }

    [JsonPropertyName("costUsd")]
    public double CostUsd { get; set; }

    [JsonPropertyName("status")]
    public string Status { get; set; } = "";

    [JsonPropertyName("stepCount")]
    public int StepCount { get; set; }

    [JsonPropertyName("durationMs")]
    public long DurationMs { get; set; }
}

public sealed class TokenUsageFile
{
    [JsonPropertyName("instanceId")]
    public string InstanceId { get; set; } = "";

    [JsonPropertyName("instanceName")]
    public string InstanceName { get; set; } = "";

    [JsonPropertyName("records")]
    public List<TokenUsageRecord> Records { get; set; } = new();
}
