"""Tests for bmadnotion CLI."""

import pytest
from click.testing import CliRunner

from bmadnotion.cli import cli


class TestCLIBasic:
    """Basic CLI tests."""

    def test_cli_help(self, cli_runner: CliRunner):
        """CLI --help should show help information."""
        result = cli_runner.invoke(cli, ["--help"])
        assert result.exit_code == 0
        assert "bmadnotion" in result.output.lower()
        assert "sync" in result.output.lower()

    def test_cli_version(self, cli_runner: CliRunner):
        """CLI --version should show version."""
        from bmadnotion import __version__

        result = cli_runner.invoke(cli, ["--version"])
        assert result.exit_code == 0
        assert __version__ in result.output

    def test_sync_pages_help(self, cli_runner: CliRunner):
        """sync pages --help should show help."""
        result = cli_runner.invoke(cli, ["sync", "pages", "--help"])
        assert result.exit_code == 0
        assert "planning artifacts" in result.output.lower()

    def test_sync_db_help(self, cli_runner: CliRunner):
        """sync db --help should show help."""
        result = cli_runner.invoke(cli, ["sync", "db", "--help"])
        assert result.exit_code == 0
        assert "sprint" in result.output.lower() or "database" in result.output.lower()

    def test_status_command_help(self, cli_runner: CliRunner):
        """status --help should show help."""
        result = cli_runner.invoke(cli, ["status", "--help"])
        assert result.exit_code == 0
        assert "status" in result.output.lower()

    def test_init_command_help(self, cli_runner: CliRunner):
        """init --help should show help."""
        result = cli_runner.invoke(cli, ["init", "--help"])
        assert result.exit_code == 0
        assert "bmad" in result.output.lower()
        assert "project" in result.output.lower()
