"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UnrecognizedStr
from openrouter.utils import validate_open_enum
import pydantic
from pydantic import ConfigDict
from pydantic.functional_validators import PlainValidator
from typing import Any, Dict, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict


OutputServerToolItemStatus = Union[
    Literal[
        "completed",
        "in_progress",
        "incomplete",
    ],
    UnrecognizedStr,
]


class OutputServerToolItemTypedDict(TypedDict):
    r"""A generic OpenRouter server tool output item"""

    type: str
    r"""Server tool type (e.g. openrouter:datetime, openrouter:web_search)"""
    status: OutputServerToolItemStatus
    id: NotRequired[str]


class OutputServerToolItem(BaseModel):
    r"""A generic OpenRouter server tool output item"""

    model_config = ConfigDict(
        populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
    )
    __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False)

    type: str
    r"""Server tool type (e.g. openrouter:datetime, openrouter:web_search)"""

    status: Annotated[
        OutputServerToolItemStatus, PlainValidator(validate_open_enum(False))
    ]

    id: Optional[str] = None

    @property
    def additional_properties(self):
        return self.__pydantic_extra__

    @additional_properties.setter
    def additional_properties(self, value):
        self.__pydantic_extra__ = value  # pyright: ignore[reportIncompatibleVariableOverride]
