"""Tools registry for all available Agno tools.

This module provides a centralized registry for all tools that can be used by agents.
Tools are registered by string name and can be instantiated dynamically when loading agents.
"""

from __future__ import annotations

from typing import TYPE_CHECKING

from mindroom.tool_system.declarations import ConfigField, SetupType, ToolCategory, ToolStatus
from mindroom.tool_system.registration import register_tool_with_metadata

if TYPE_CHECKING:
    from agno.tools.github import GithubTools


@register_tool_with_metadata(
    name="github",
    display_name="GitHub",
    description="Repository and issue management",
    category=ToolCategory.DEVELOPMENT,
    status=ToolStatus.REQUIRES_CONFIG,
    setup_type=SetupType.API_KEY,
    icon="SiGithub",
    icon_color="text-gray-800",  # GitHub black
    config_fields=[
        ConfigField(
            name="access_token",
            label="Access Token",
            type="password",
            required=False,
            default=None,
        ),
        ConfigField(
            name="base_url",
            label="Base URL",
            type="url",
            required=False,
            default=None,
        ),
    ],
    dependencies=["PyGithub"],
    docs_url="https://docs.agno.com/tools/toolkits/others/github",
    function_names=(
        "assign_issue",
        "close_issue",
        "comment_on_issue",
        "create_branch",
        "create_file",
        "create_issue",
        "create_pull_request",
        "create_pull_request_comment",
        "create_repository",
        "create_review_request",
        "delete_file",
        "delete_repository",
        "edit_issue",
        "edit_pull_request_comment",
        "get_branch_content",
        "get_directory_content",
        "get_file_content",
        "get_issue",
        "get_pull_request",
        "get_pull_request_changes",
        "get_pull_request_comments",
        "get_pull_request_count",
        "get_pull_request_with_details",
        "get_pull_requests",
        "get_repository",
        "get_repository_languages",
        "get_repository_stars",
        "get_repository_with_stats",
        "label_issue",
        "list_branches",
        "list_issue_comments",
        "list_issues",
        "list_repositories",
        "reopen_issue",
        "search_code",
        "search_issues_and_prs",
        "search_repositories",
        "set_default_branch",
        "update_file",
    ),
)
def github_tools() -> type[GithubTools]:
    """Return GitHub tools for repository management."""
    from agno.tools.github import GithubTools

    return GithubTools
