using System.Text.Json.Serialization;

namespace ClawdDotNet.UI;

public sealed record BridgeMessage(
    [property: JsonPropertyName("type")] string Type,
    [property: JsonPropertyName("agentId")] string? AgentId = null,
    [property: JsonPropertyName("content")] string? Content = null,
    [property: JsonPropertyName("status")] string? Status = null,
    [property: JsonPropertyName("stepCount")] int? StepCount = null,
    [property: JsonPropertyName("tokenCount")] int? TokenCount = null,
    [property: JsonPropertyName("error")] string? Error = null,
    [property: JsonPropertyName("extra")] object? Extra = null
);

public static class BridgeTypes
{
    // C# → Browser
    public const string AgentListUpdate = "agent_list_update";
    public const string AgentStatusUpdate = "agent_status";
    public const string SelectAgent = "select_agent";
    public const string ChatMessage = "chat_message";
    public const string ChatTyping = "chat_typing";
    public const string ChatHistory = "chat_history";
    public const string RunStarted = "run_started";
    public const string RunFinished = "run_finished";

    // Browser → C#
    public const string UserMessage = "user_message";
    public const string OpenAgentChat = "open_agent_chat";
    public const string RunNow = "run_now";
    public const string AbortRun = "abort_run";
}
