"""Step definitions for TUI slash command catalog coverage."""

from __future__ import annotations

from behave import given, then


@given("the TUI slash command catalog module is loaded")
def step_catalog_loaded(context):
    from cleveragents.tui.slash_catalog import slash_command_groups, slash_command_names

    context._slash_command_names = slash_command_names()
    context._slash_command_groups = slash_command_groups()


@then("the slash command catalog should contain at least {minimum:d} commands")
def step_catalog_command_count(context, minimum):
    assert len(context._slash_command_names) >= minimum


@then("the slash command catalog should contain exactly {expected:d} groups")
def step_catalog_group_count(context, expected):
    assert len(context._slash_command_groups) == expected


@then('the slash command catalog should include "{command}"')
def step_catalog_contains_command(context, command):
    assert command in context._slash_command_names
