# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .tool_server_id import ToolServerId
from .tool_server_name import ToolServerName
from .tool_server_transport import ToolServerTransport
from .tool_server_type import ToolServerType


class ToolServer(UniversalBaseModel):
    """
    Represents a tool server that can provide various functionalities.
    """

    id: typing.Optional[ToolServerId] = None
    name: ToolServerName
    type: ToolServerType = "mcp"
    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    A detailed description of what this tool server does.
    """

    uri: str = pydantic.Field()
    """
    The URI of the server.
    """

    headers: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None)
    """
    Optional HTTP headers to include when connecting to the server.
    """

    transport: ToolServerTransport
    enabled: bool = pydantic.Field()
    """
    Whether the tool server is currently enabled and available for use.
    """

    metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Arbitrary metadata associated with the tool server.
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Timestamp when the tool server was created.
    """

    updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Timestamp when the tool server was last updated.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
