using System.Text.Json.Serialization;

namespace ColaFlow.Modules.Mcp.Contracts.Mcp;

/// <summary>
/// MCP server capabilities
/// </summary>
public class McpServerCapabilities
{
    /// <summary>
    /// Resources capability
    /// </summary>
    [JsonPropertyName("resources")]
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public McpResourcesCapability? Resources { get; set; }

    /// <summary>
    /// Tools capability
    /// </summary>
    [JsonPropertyName("tools")]
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public McpToolsCapability? Tools { get; set; }

    /// <summary>
    /// Prompts capability
    /// </summary>
    [JsonPropertyName("prompts")]
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public McpPromptsCapability? Prompts { get; set; }

    /// <summary>
    /// Creates default server capabilities with all features supported
    /// </summary>
    public static McpServerCapabilities CreateDefault()
    {
        return new McpServerCapabilities
        {
            Resources = new McpResourcesCapability { Supported = true },
            Tools = new McpToolsCapability { Supported = true },
            Prompts = new McpPromptsCapability { Supported = true }
        };
    }
}

/// <summary>
/// Resources capability
/// </summary>
public class McpResourcesCapability
{
    /// <summary>
    /// Indicates if resources are supported
    /// </summary>
    [JsonPropertyName("supported")]
    public bool Supported { get; set; }
}

/// <summary>
/// Tools capability
/// </summary>
public class McpToolsCapability
{
    /// <summary>
    /// Indicates if tools are supported
    /// </summary>
    [JsonPropertyName("supported")]
    public bool Supported { get; set; }
}

/// <summary>
/// Prompts capability
/// </summary>
public class McpPromptsCapability
{
    /// <summary>
    /// Indicates if prompts are supported
    /// </summary>
    [JsonPropertyName("supported")]
    public bool Supported { get; set; }
}
