@using LazyBear.MCP.Services.ToolRegistry
@inject ToolRegistryService Registry

@foreach (var (tool, idx) in Module.ToolNames.Select((t, i) => (t, i)))
{
    var toolEnabled = Registry.IsToolEnabled(Module.ModuleName, tool);
    var toolName = tool;
    var moduleName = Module.ModuleName;
    var fo = StartFocusIdx + idx;

    <TextButton Content="@(toolEnabled ? $"✓ {toolName}" : $"✗ {toolName}")"
                OnClick="@(() => Registry.ToggleTool(moduleName, toolName))"
                BackgroundColor="@(toolEnabled ? Spectre.Console.Color.DarkGreen : Spectre.Console.Color.Grey11)"
                FocusedColor="@Spectre.Console.Color.Yellow"
                FocusOrder="@fo" />
}

@code {
    [Parameter, EditorRequired] public IToolModule Module { get; set; } = null!;
    [Parameter] public int StartFocusIdx { get; set; } = 100;
}
