using System.Text.Json.Serialization;

namespace AxCopilot.Models;

/// <summary>MCP 서버 연결 설정.</summary>
public class McpServerEntry
{
    [JsonPropertyName("name")]
    public string Name { get; set; } = "";

    [JsonPropertyName("command")]
    public string Command { get; set; } = "";

    [JsonPropertyName("args")]
    public List<string> Args { get; set; } = new();

    [JsonPropertyName("env")]
    public Dictionary<string, string> Env { get; set; } = new();

    [JsonPropertyName("enabled")]
    public bool Enabled { get; set; } = true;

    /// <summary>연결 방식: stdio | sse</summary>
    [JsonPropertyName("transport")]
    public string Transport { get; set; } = "stdio";

    /// <summary>SSE 방식일 때 서버 URL.</summary>
    [JsonPropertyName("url")]
    public string? Url { get; set; }
}

/// <summary>MCP 도구 정의 (서버에서 수신).</summary>
public class McpToolDefinition
{
    public string Name { get; set; } = "";
    public string Description { get; set; } = "";
    public string ServerName { get; set; } = "";
    public Dictionary<string, McpParameterDef> Parameters { get; set; } = new();
}

public class McpParameterDef
{
    public string Type { get; set; } = "string";
    public string Description { get; set; } = "";
    public bool Required { get; set; } = false;
}
