"""Rich-click configuration for the CLI."""

import rich_click as click

click.rich_click.TEXT_MARKUP = "markdown"
click.rich_click.SHOW_ARGUMENTS = True
click.rich_click.GROUP_ARGUMENTS_OPTIONS = True
click.rich_click.STYLE_HELPTEXT = ""
click.rich_click.STYLE_OPTION = "cyan"
click.rich_click.STYLE_ARGUMENT = "cyan"
click.rich_click.STYLE_COMMAND = "green"
click.rich_click.STYLE_SWITCH = "bold green"

click.rich_click.OPTION_GROUPS = {
    "handler": [
        {"name": "Global Options", "options": ["--verbose", "--debug", "--help"]},
    ],
    "handler message send": [
        {
            "name": "Message Options",
            "options": ["--stream", "--continue", "--context-id", "--task-id"],
        },
        {
            "name": "Authentication Options",
            "options": ["--bearer", "--api-key"],
        },
        {
            "name": "Push Notification Options",
            "options": ["--push-url", "--push-token"],
        },
    ],
    "handler message stream": [
        {
            "name": "Conversation Options",
            "options": ["--continue", "--context-id", "--task-id"],
        },
        {
            "name": "Authentication Options",
            "options": ["--bearer", "--api-key"],
        },
        {
            "name": "Push Notification Options",
            "options": ["--push-url", "--push-token"],
        },
    ],
    "handler task get": [
        {"name": "Query Options", "options": ["--history-length"]},
    ],
    "handler task notification set": [
        {"name": "Notification Options", "options": ["--url", "--token"]},
    ],
    "handler card get": [
        {"name": "Card Options", "options": ["--authenticated"]},
    ],
    "handler server agent": [
        {"name": "Server Options", "options": ["--host", "--port", "--help"]},
    ],
    "handler server push": [
        {"name": "Server Options", "options": ["--host", "--port", "--help"]},
    ],
    "handler session clear": [
        {"name": "Clear Options", "options": ["--all", "--help"]},
    ],
    "handler auth set": [
        {
            "name": "Auth Type",
            "options": ["--bearer", "--api-key", "--api-key-header"],
        },
    ],
}

click.rich_click.COMMAND_GROUPS = {
    "handler": [
        {"name": "Agent Communication", "commands": ["message", "task"]},
        {"name": "Agent Discovery", "commands": ["card"]},
        {"name": "Authentication", "commands": ["auth"]},
        {"name": "Interfaces", "commands": ["tui", "web", "server"]},
        {"name": "Utilities", "commands": ["session", "version"]},
    ],
    "handler message": [
        {"name": "Message Commands", "commands": ["send", "stream"]},
    ],
    "handler task": [
        {"name": "Task Commands", "commands": ["get", "cancel", "resubscribe"]},
        {"name": "Push Notifications", "commands": ["notification"]},
    ],
    "handler task notification": [
        {"name": "Notification Commands", "commands": ["set"]},
    ],
    "handler card": [
        {"name": "Card Commands", "commands": ["get", "validate"]},
    ],
    "handler server": [
        {"name": "Server Commands", "commands": ["agent", "push"]},
    ],
    "handler session": [
        {"name": "Session Commands", "commands": ["list", "show", "clear"]},
    ],
    "handler auth": [
        {"name": "Auth Commands", "commands": ["set", "show", "clear"]},
    ],
}
