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


@dataclass(kw_only=True)
class ElicitRequest:
    """Request for user input."""
    client_id: str
    message: str
    request: str


class ElicitAction(str):
    """Outcome of an elicitation request."""
    __slots__ = ()

    ACCEPT: ElicitAction
    DECLINE: ElicitAction
    CANCEL: ElicitAction

ElicitAction.ACCEPT = ElicitAction('accept')  # type: ignore[attr-defined]
ElicitAction.DECLINE = ElicitAction('decline')  # type: ignore[attr-defined]
ElicitAction.CANCEL = ElicitAction('cancel')  # type: ignore[attr-defined]


@dataclass(kw_only=True)
class ElicitResponse:
    """Response to an elicitation request."""
    action: ElicitAction
    content: str | None


class ElicitationError:
    """Why an elicitation call failed."""

    class UnknownClient(_WitVariantCase):
        """No handler registered for the given `client-id`."""
        tag = 'unknown-client'

    class HandlerFailed(_WitVariantCase):
        """Handler raised an exception."""
        tag = 'handler-failed'

    class TimedOut(_WitVariantCase):
        """Request timed out waiting for a human response."""
        tag = 'timed-out'

    _CASES: dict[str, type] = {
        'unknown-client': UnknownClient,
        'handler-failed': HandlerFailed,
        'timed-out': TimedOut,
    }

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