"""CoStrict slash command configurator.

Configures slash commands for CoStrict AI in .cospec/aurora/commands/ directory.
"""

from aurora_cli.configurators.slash.base import SlashCommandConfigurator
from aurora_cli.templates.slash_commands import get_command_body


# Frontmatter for each command
FRONTMATTER: dict[str, str] = {
    "plan": """---
description: "Generate structured plans with agent delegation"
argument-hint: feature description or request
---""",
    "query": """---
description: "Search codebase using memory system"
argument-hint: your question about the codebase
---""",
    "index": """---
description: "Index codebase for semantic search"
argument-hint: path to index
---""",
    "search": """---
description: "Search indexed code"
argument-hint: search query
---""",
    "init": """---
description: "Initialize Aurora for the project"
argument-hint: (optional) flags
---""",
    "doctor": """---
description: "Run health checks on Aurora installation"
argument-hint: (optional) flags
---""",
    "agents": """---
description: "Browse and search available AI agents"
argument-hint: (optional) search term
---""",
}

# File paths for each command
FILE_PATHS: dict[str, str] = {
    "plan": ".cospec/aurora/commands/aurora-plan.md",
    "query": ".cospec/aurora/commands/aurora-query.md",
    "index": ".cospec/aurora/commands/aurora-index.md",
    "search": ".cospec/aurora/commands/aurora-search.md",
    "init": ".cospec/aurora/commands/aurora-init.md",
    "doctor": ".cospec/aurora/commands/aurora-doctor.md",
    "agents": ".cospec/aurora/commands/aurora-agents.md",
}


class CostrictSlashCommandConfigurator(SlashCommandConfigurator):
    """Slash command configurator for CoStrict AI.

    Creates slash commands in .cospec/aurora/commands/ directory for
    all Aurora commands.
    """

    @property
    def tool_id(self) -> str:
        """Tool identifier."""
        return "costrict"

    @property
    def is_available(self) -> bool:
        """CoStrict is always available (doesn't require detection)."""
        return True

    def get_relative_path(self, command_id: str) -> str:
        """Get relative path for a slash command file.

        Args:
            command_id: Command identifier

        Returns:
            Relative path from project root
        """
        return FILE_PATHS[command_id]

    def get_frontmatter(self, command_id: str) -> str | None:
        """Get frontmatter for a slash command file.

        Args:
            command_id: Command identifier

        Returns:
            YAML frontmatter string
        """
        return FRONTMATTER[command_id]

    def get_body(self, command_id: str) -> str:
        """Get body content for a slash command.

        Args:
            command_id: Command identifier

        Returns:
            Command body content from templates
        """
        return get_command_body(command_id)
