# generated by datamodel-codegen:
#   filename:  tool_definition.schema.json
#   timestamp: 2026-03-03T01:18:26+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated, Any

from pydantic import BaseModel, ConfigDict, Field


class ToolType(Enum):
    direct = 'direct'
    delegated = 'delegated'


class InputMode(Enum):
    resolve = 'resolve'
    protect = 'protect'


class Kind(Enum):
    http = 'http'


class Method(Enum):
    POST = 'POST'


class SecurityContext(Enum):
    auto = 'auto'
    off = 'off'


class DelegatedTransport(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    kind: Kind | None = None
    url: str | None = None
    base_url: str | None = None
    path: str | None = None
    method: Method | None = None
    timeout_s: Annotated[float | None, Field(gt=0.0)] = None
    headers: dict[str, str] | None = None
    prompt_arg: str | None = None
    messages_arg: str | None = None
    include_args: bool | None = None
    recursion_limit: Annotated[int | None, Field(ge=1)] = None
    security_context: SecurityContext | None = None


class ToolDefinition(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    name: str
    description: str | None = None
    parameters: dict[str, Any] | None = None
    source: Annotated[
        str | None,
        Field(description='Tool origin (e.g., mcp, builtin, internal, external).'),
    ] = None
    tool_type: Annotated[
        ToolType,
        Field(
            description='Tool execution mode. direct resolves placeholders at execution according to input_mode; delegated receives placeholders and manages nested tool resolution itself.'
        ),
    ]
    input_mode: Annotated[
        InputMode | None,
        Field(
            description='Direct-tool input handling. resolve materializes originals at execution; protect keeps placeholders in direct tool args. Ignored for delegated tools.'
        ),
    ] = None
    delegated_transport: Annotated[
        str | DelegatedTransport | None,
        Field(
            description='Delegated remote transport. If set on a local delegated tool with no handler, runtime performs an automatic delegated handoff and propagates Dymium context.'
        ),
    ] = None
