"""Auto-generated IR node types for ADK agent classes.

DO NOT EDIT MANUALLY. This file is regenerated by:
    python scripts/ir_generator.py manifest.json --output src/adk_fluent/_ir_generated.py

Generated from google-adk 1.25.0 (manifest ee6c926313c5)
"""

from __future__ import annotations

from collections.abc import Callable
from dataclasses import dataclass, field
from typing import Any

from adk_fluent._ir import (
    FallbackNode,
    GateNode,
    MapOverNode,
    RaceNode,
    RouteNode,
    TapNode,
    TimeoutNode,
    TransferNode,
    TransformNode,
)

__all__ = [
    "AgentNode",
    "SequenceNode",
    "ParallelNode",
    "LoopNode",
    "FullNode",
]


@dataclass(frozen=True)
class AgentNode:
    """Generated IR node for ADK LlmAgent.

    LLM-based Agent.
    """

    name: str
    description: Any = ""
    children: tuple = ()
    model: Any = ""
    instruction: Any = ""
    global_instruction: Any = ""
    static_instruction: Any = None
    tools: tuple = ()
    generate_content_config: Any = None
    disallow_transfer_to_parent: Any = False
    disallow_transfer_to_peers: Any = False
    include_contents: Any = "default"
    input_schema: Any = None
    output_schema: Any = None
    output_key: Any = None
    planner: Any = None
    code_executor: Any = None
    # Merged callback fields: before_agent_callback, after_agent_callback, before_model_callback, after_model_callback, on_model_error_callback, before_tool_callback, after_tool_callback, on_tool_error_callback
    callbacks: dict[str, tuple[Callable, ...]] = field(default_factory=dict)

    # --- adk-fluent extension fields ---
    writes_keys: frozenset[str] = frozenset()
    reads_keys: frozenset[str] = frozenset()
    produces_type: type | None = None
    consumes_type: type | None = None
    context_spec: Any = None  # CTransform descriptor, preserved for diagnostics
    prompt_spec: Any = None  # PTransform descriptor, preserved for diagnostics
    tool_schema: type | None = None  # ToolSchema class, preserved for diagnostics
    callback_schema: type | None = None  # CallbackSchema class, preserved for diagnostics
    prompt_schema: type | None = None  # PromptSchema class, preserved for diagnostics
    artifact_schema: type | None = None  # ArtifactSchema class, preserved for diagnostics
    guard_specs: tuple = ()  # GGuard specs, preserved for contract checking


@dataclass(frozen=True)
class SequenceNode:
    """Generated IR node for ADK SequentialAgent.

    A shell agent that runs its sub-agents in sequence.
    """

    name: str
    description: Any = ""
    children: tuple = ()
    # Merged callback fields: before_agent_callback, after_agent_callback
    callbacks: dict[str, tuple[Callable, ...]] = field(default_factory=dict)

    # --- adk-fluent extension fields ---
    writes_keys: frozenset[str] = frozenset()
    reads_keys: frozenset[str] = frozenset()
    produces_type: type | None = None
    consumes_type: type | None = None
    context_spec: Any = None  # CTransform descriptor, preserved for diagnostics
    middlewares: tuple = ()  # Middleware instances for contract checking (Pass 14)


@dataclass(frozen=True)
class ParallelNode:
    """Generated IR node for ADK ParallelAgent.

    A shell agent that runs its sub-agents in parallel in an isolated manner.
    """

    name: str
    description: Any = ""
    children: tuple = ()
    # Merged callback fields: before_agent_callback, after_agent_callback
    callbacks: dict[str, tuple[Callable, ...]] = field(default_factory=dict)

    # --- adk-fluent extension fields ---
    writes_keys: frozenset[str] = frozenset()
    reads_keys: frozenset[str] = frozenset()
    produces_type: type | None = None
    consumes_type: type | None = None
    context_spec: Any = None  # CTransform descriptor, preserved for diagnostics


@dataclass(frozen=True)
class LoopNode:
    """Generated IR node for ADK LoopAgent.

    A shell agent that run its sub-agents in a loop.
    """

    name: str
    description: Any = ""
    children: tuple = ()
    max_iterations: Any = None
    # Merged callback fields: before_agent_callback, after_agent_callback
    callbacks: dict[str, tuple[Callable, ...]] = field(default_factory=dict)

    # --- adk-fluent extension fields ---
    writes_keys: frozenset[str] = frozenset()
    reads_keys: frozenset[str] = frozenset()
    produces_type: type | None = None
    consumes_type: type | None = None
    context_spec: Any = None  # CTransform descriptor, preserved for diagnostics


# ======================================================================
# Full Node type union (generated + hand-written)
# ======================================================================

FullNode = (
    AgentNode
    | SequenceNode
    | ParallelNode
    | LoopNode
    | TransformNode
    | TapNode
    | FallbackNode
    | RaceNode
    | GateNode
    | MapOverNode
    | TimeoutNode
    | RouteNode
    | TransferNode
)
