from .schemas import ToolDefinition, FetchNewsParams, FetchArxivParams, FetchDDGParams, FetchTorrentsParams, FetchWikiParams, FetchIMDBParams, FetchYouTubeParams, FetchFinanceParams
from modules.search.web import (
    fetch_torrents,
    fetch_news,
    fetch_wikipedia,
    fetch_imdb,
    fetch_youtube,
    fetch_finance,
    search_google
)
from modules.search.news import fetch_news
from modules.search.arxiv import fetch_arxiv

def schema_to_tool(name: str, model: type) -> ToolDefinition:
    return ToolDefinition(
        name=name,
        description=model.__doc__.strip(),
        parameters=model.model_json_schema()
    )

tool_definitions: list[ToolDefinition] = [
    schema_to_tool("fetch_news", FetchNewsParams),
    schema_to_tool("fetch_arxiv", FetchArxivParams),
    schema_to_tool("search_google", FetchDDGParams),
    schema_to_tool("fetch_torrents", FetchTorrentsParams),
    schema_to_tool("fetch_wikipedia", FetchWikiParams),
    schema_to_tool("fetch_imdb", FetchIMDBParams),
    schema_to_tool("fetch_youtube", FetchYouTubeParams),
    schema_to_tool("fetch_finance", FetchFinanceParams)
]