"""BotManifold CLI entry point."""

from __future__ import annotations

import logging

import click

from .commands.arena import arena
from .commands.verify import verify

import botmanifold


@click.group()
@click.option("-v", "--verbose", is_flag=True, help="Enable verbose logging.")
@click.version_option(version=botmanifold.__version__, prog_name="botmanifold")
@click.pass_context
def main(ctx: click.Context, verbose: bool) -> None:
    """BotManifold CLI - Robot Policy Verification & Competition.

    \b
    Commands:
      verify     Verify a policy for safety
      arena      Competition: submit, status, leaderboard

    \b
    Quick Start:
      botmanifold verify my_policy.zip --scenario messy_room
      botmanifold arena submit my_policy.zip --scenario messy_room
    """
    level = logging.DEBUG if verbose else logging.INFO
    logging.basicConfig(level=level, format="%(levelname)s: %(message)s")

    ctx.ensure_object(dict)
    ctx.obj["verbose"] = verbose


main.add_command(verify)
main.add_command(arena)


if __name__ == "__main__":
    main()
