"""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, Self

from google.adk.agents import RunConfig as _ADK_RunConfig

from adk_fluent._base import BuilderBase


class RunConfig(BuilderBase):
    """Configuration for agent runs."""

    _ALIASES: dict[str, str] = {}
    _CALLBACK_ALIASES: dict[str, str] = {}
    _ADDITIVE_FIELDS: set[str] = set()
    _ADK_TARGET_CLASS = _ADK_RunConfig

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

    def max_llm_calls(self, value: int) -> Self:
        """Set the ``max_llm_calls`` field."""
        self = self._maybe_fork_for_mutation()
        self._config["max_llm_calls"] = value
        return self

    def speech_config(self, value: SpeechConfig | None) -> Self:
        """Set the ``speech_config`` field."""
        self = self._maybe_fork_for_mutation()
        self._config["speech_config"] = value
        return self

    def build(self) -> _ADK_RunConfig:
        """Configuration for agent runs. Resolve into a native ADK _ADK_RunConfig."""
        config = self._prepare_build_config()
        result = self._safe_build(_ADK_RunConfig, config)
        return self._apply_native_hooks(result)
