"""Wikipedia tool configuration."""

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.wikipedia import WikipediaTools


@register_tool_with_metadata(
    name="wikipedia",
    display_name="Wikipedia",
    description="Search and retrieve information from Wikipedia",
    category=ToolCategory.RESEARCH,
    status=ToolStatus.AVAILABLE,
    setup_type=SetupType.NONE,
    icon="SiWikipedia",
    icon_color="text-gray-700",
    config_fields=[
        ConfigField(
            name="knowledge",
            label="Knowledge",
            type="text",
            required=False,
            default=None,
        ),
        ConfigField(
            name="auto_suggest",
            label="Auto Suggest",
            type="boolean",
            required=False,
            default=True,
        ),
        ConfigField(
            name="all",
            label="All",
            type="boolean",
            required=False,
            default=False,
        ),
    ],
    dependencies=["wikipedia"],
    docs_url="https://docs.agno.com/tools/toolkits/search/wikipedia",
    function_names=("search_wikipedia", "search_wikipedia_and_update_knowledge_base"),
)
def wikipedia_tools() -> type[WikipediaTools]:
    """Return Wikipedia tools for searching and retrieving information."""
    from agno.tools.wikipedia import WikipediaTools

    return WikipediaTools
