"""Gemini tool configuration."""

from __future__ import annotations

from typing import TYPE_CHECKING

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

if TYPE_CHECKING:
    from mindroom.custom_tools.gemini_media import MindRoomGeminiTools


@register_tool_with_metadata(
    name="gemini",
    display_name="Gemini",
    description="Google AI API services for generating images and videos using Gemini models",
    category=ToolCategory.DEVELOPMENT,
    status=ToolStatus.REQUIRES_CONFIG,
    setup_type=SetupType.API_KEY,
    icon="SiGooglegemini",
    icon_color="text-blue-500",
    config_fields=[
        ConfigField(
            name="api_key",
            label="API Key",
            type="password",
            required=False,
            default=None,
        ),
        ConfigField(
            name="vertexai",
            label="Vertexai",
            type="boolean",
            required=False,
            default=False,
        ),
        ConfigField(
            name="project_id",
            label="Project ID",
            type="text",
            required=False,
            default=None,
        ),
        ConfigField(
            name="location",
            label="Location",
            type="text",
            required=False,
            default=None,
        ),
        ConfigField(
            name="image_generation_model",
            label="Image Generation Model",
            type="text",
            required=False,
            default=GOOGLE_IMAGE,
        ),
        ConfigField(
            name="video_generation_model",
            label="Video Generation Model",
            type="text",
            required=False,
            default=GOOGLE_VEO,
        ),
        ConfigField(
            name="enable_generate_image",
            label="Enable Generate Image",
            type="boolean",
            required=False,
            default=True,
        ),
        ConfigField(
            name="enable_generate_video",
            label="Enable Generate Video",
            type="boolean",
            required=False,
            default=True,
        ),
        ConfigField(
            name="all",
            label="All",
            type="boolean",
            required=False,
            default=False,
        ),
    ],
    dependencies=["google-genai"],
    docs_url="https://docs.agno.com/tools/toolkits/models/gemini",
    function_names=("generate_image", "generate_video"),
)
def gemini_tools() -> type[MindRoomGeminiTools]:
    """Return Gemini tools for image and video generation."""
    from mindroom.custom_tools.gemini_media import MindRoomGeminiTools

    return MindRoomGeminiTools
