"""Auto-generated by bindgen. Do not edit."""
# ruff: noqa: E501, F401, I001
# fmt: off

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Optional, Union

from wasmtime.component import Variant as _WitVariant
from wasmtime.component import VariantCase as _WitVariantCase

from .tools import ToolSpec


Duration = int

class McpConnectionState(str):
    """Connection state of an MCP client."""
    __slots__ = ()

    DISCONNECTED: McpConnectionState
    CONNECTED: McpConnectionState
    FAILED: McpConnectionState

McpConnectionState.DISCONNECTED = McpConnectionState('disconnected')  # type: ignore[attr-defined]
McpConnectionState.CONNECTED = McpConnectionState('connected')  # type: ignore[attr-defined]
McpConnectionState.FAILED = McpConnectionState('failed')  # type: ignore[attr-defined]


@dataclass(kw_only=True)
class EnvVar:
    """Single environment variable entry."""
    key: str
    value: str


@dataclass(kw_only=True)
class StdioTransport:
    """STDIO transport configuration."""
    command: str
    args: list[str]
    env: list[EnvVar]
    cwd: str | None


@dataclass(kw_only=True)
class HttpHeader:
    """Single HTTP header entry."""
    name: str
    value: str


@dataclass(kw_only=True)
class HttpTransport:
    """HTTP transport configuration."""
    url: str
    headers: list[HttpHeader]


@dataclass(kw_only=True)
class SseTransport:
    """SSE transport configuration."""
    url: str
    headers: list[HttpHeader]


class McpTransport:
    """How the client talks to the MCP server."""

    class Stdio(_WitVariantCase):
        """STDIO transport. Spawn a local process and talk via pipes."""
        tag = 'stdio'

    class StreamableHttp(_WitVariantCase):
        """Streamable HTTP transport, per the current MCP specification."""
        tag = 'streamable-http'

    class Sse(_WitVariantCase):
        """Legacy Server-Sent Events transport. Retained for older servers."""
        tag = 'sse'

    _CASES: dict[str, type] = {
        'stdio': Stdio,
        'streamable-http': StreamableHttp,
        'sse': Sse,
    }

    @staticmethod
    def lift(raw: _WitVariant) -> McpTransport:
        cls = McpTransport._CASES.get(raw.tag)
        if cls is None:
            raise ValueError(f'unknown McpTransport arm: {raw.tag!r}')
        return cls(raw.payload)

@dataclass(kw_only=True)
class TasksConfig:
    """Task-augmented tool execution. Enables long-running tools with
progress tracking. Experimental in the MCP specification."""
    ttl: int
    poll_timeout: int


@dataclass(kw_only=True)
class McpClientConfig:
    """MCP client configuration."""
    client_id: str
    application_name: str | None
    application_version: str | None
    transport: McpTransport
    tasks_config: TasksConfig | None
    elicitation_enabled: bool
    fail_open: bool
    disable_instrumentation: bool
