"""Hacker News 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.hackernews import HackerNewsTools


@register_tool_with_metadata(
    name="hackernews",
    display_name="Hacker News",
    description="Get top stories and user details from Hacker News",
    category=ToolCategory.RESEARCH,
    status=ToolStatus.AVAILABLE,
    setup_type=SetupType.NONE,
    icon="FaHackerNews",
    icon_color="text-orange-600",  # Hacker News orange
    config_fields=[
        ConfigField(
            name="enable_get_top_stories",
            label="Enable Get Top Stories",
            type="boolean",
            required=False,
            default=True,
        ),
        ConfigField(
            name="enable_get_user_details",
            label="Enable Get User Details",
            type="boolean",
            required=False,
            default=True,
        ),
        ConfigField(
            name="all",
            label="All",
            type="boolean",
            required=False,
            default=False,
        ),
    ],
    dependencies=["httpx"],
    docs_url="https://docs.agno.com/tools/toolkits/search/hackernews",
    function_names=("get_top_hackernews_stories", "get_user_details"),
)
def hackernews_tools() -> type[HackerNewsTools]:
    """Return Hacker News tools for getting stories and user details."""
    from agno.tools.hackernews import HackerNewsTools

    return HackerNewsTools
