"""Auto-generated by adk-fluent generator. Manual edits will be overwritten."""

from __future__ import annotations

from collections import defaultdict
from collections.abc import Callable
from typing import Any

from google.adk.planners.base_planner import BasePlanner as _ADK_BasePlanner
from google.adk.planners.built_in_planner import BuiltInPlanner as _ADK_BuiltInPlanner
from google.adk.planners.plan_re_act_planner import PlanReActPlanner as _ADK_PlanReActPlanner

from adk_fluent._base import BuilderBase


class BasePlanner(BuilderBase):
    """Abstract base class for all planners."""

    _ALIASES: dict[str, str] = {}
    _CALLBACK_ALIASES: dict[str, str] = {}
    _ADDITIVE_FIELDS: set[str] = set()
    _KNOWN_PARAMS: set[str] | None = set()

    def __init__(self, args: str, kwargs: str) -> None:
        self._config: dict[str, Any] = {"args": args, "kwargs": kwargs}
        self._callbacks: dict[str, list[Callable]] = defaultdict(list)
        self._lists: dict[str, list] = defaultdict(list)
        self._frozen = False

    def build(self) -> _ADK_BasePlanner:
        """Abstract base class for all planners. Resolve into a native ADK _ADK_BasePlanner."""
        config = self._prepare_build_config()
        result = self._safe_build(_ADK_BasePlanner, config)
        return self._apply_native_hooks(result)


class BuiltInPlanner(BuilderBase):
    """The built-in planner that uses model's built-in thinking features."""

    _ALIASES: dict[str, str] = {}
    _CALLBACK_ALIASES: dict[str, str] = {}
    _ADDITIVE_FIELDS: set[str] = set()
    _KNOWN_PARAMS: set[str] | None = {"thinking_config"}

    def __init__(self, thinking_config: str) -> None:
        self._config: dict[str, Any] = {"thinking_config": thinking_config}
        self._callbacks: dict[str, list[Callable]] = defaultdict(list)
        self._lists: dict[str, list] = defaultdict(list)
        self._frozen = False

    def build(self) -> _ADK_BuiltInPlanner:
        """The built-in planner that uses model's built-in thinking features. Resolve into a native ADK _ADK_BuiltInPlanner."""
        config = self._prepare_build_config()
        result = self._safe_build(_ADK_BuiltInPlanner, config)
        return self._apply_native_hooks(result)


class PlanReActPlanner(BuilderBase):
    """Plan-Re-Act planner that constrains the LLM response to generate a plan before any action/observation."""

    _ALIASES: dict[str, str] = {}
    _CALLBACK_ALIASES: dict[str, str] = {}
    _ADDITIVE_FIELDS: set[str] = set()
    _KNOWN_PARAMS: set[str] | None = set()

    def __init__(self, args: str, kwargs: str) -> None:
        self._config: dict[str, Any] = {"args": args, "kwargs": kwargs}
        self._callbacks: dict[str, list[Callable]] = defaultdict(list)
        self._lists: dict[str, list] = defaultdict(list)
        self._frozen = False

    def build(self) -> _ADK_PlanReActPlanner:
        """Plan-Re-Act planner that constrains the LLM response to generate a plan before any action/observation. Resolve into a native ADK _ADK_PlanReActPlanner."""
        config = self._prepare_build_config()
        result = self._safe_build(_ADK_PlanReActPlanner, config)
        return self._apply_native_hooks(result)
