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

import typing

import pydantic
import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.serialization import FieldMetadata
from ...core.unchecked_base_model import UncheckedBaseModel
from .single_prompt_config_tools_item_headers_item import SinglePromptConfigToolsItemHeadersItem
from .single_prompt_config_tools_item_method import SinglePromptConfigToolsItemMethod
from .single_prompt_config_tools_item_query_params_item import SinglePromptConfigToolsItemQueryParamsItem
from .single_prompt_config_tools_item_request_body_schema import SinglePromptConfigToolsItemRequestBodySchema
from .single_prompt_config_tools_item_response_variables_item import SinglePromptConfigToolsItemResponseVariablesItem
from .single_prompt_config_tools_item_type import SinglePromptConfigToolsItemType
from .single_prompt_config_tools_item_variables_extraction_schema_item import (
    SinglePromptConfigToolsItemVariablesExtractionSchemaItem,
)
from .single_prompt_config_tools_item_variables_item import SinglePromptConfigToolsItemVariablesItem


class SinglePromptConfigToolsItem(UncheckedBaseModel):
    type: SinglePromptConfigToolsItemType = pydantic.Field()
    """
    The type of function/tool
    """

    name: str = pydantic.Field()
    """
    Unique name for the function
    """

    description: str = pydantic.Field()
    """
    Description of what the function does
    """

    url: typing.Optional[str] = pydantic.Field(default=None)
    """
    Required for api_call type. The URL to make the HTTP request to
    """

    method: typing.Optional[SinglePromptConfigToolsItemMethod] = pydantic.Field(default=None)
    """
    Required for api_call type. HTTP method to use
    """

    timeout: typing.Optional[int] = pydantic.Field(default=None)
    """
    Optional for api_call type. Request timeout in milliseconds (1000-30000)
    """

    headers: typing.Optional[typing.List[SinglePromptConfigToolsItemHeadersItem]] = pydantic.Field(default=None)
    """
    Optional for api_call type. HTTP headers to include in the request
    """

    query_params: typing_extensions.Annotated[
        typing.Optional[typing.List[SinglePromptConfigToolsItemQueryParamsItem]],
        FieldMetadata(alias="queryParams"),
        pydantic.Field(
            alias="queryParams", description="Optional for api_call type. Query parameters to include in the request"
        ),
    ] = None
    request_body_schema: typing_extensions.Annotated[
        typing.Optional[SinglePromptConfigToolsItemRequestBodySchema],
        FieldMetadata(alias="requestBodySchema"),
        pydantic.Field(
            alias="requestBodySchema",
            description="Optional for api_call type. Schema defining the structure of the request body",
        ),
    ] = None
    response_variables: typing_extensions.Annotated[
        typing.Optional[typing.List[SinglePromptConfigToolsItemResponseVariablesItem]],
        FieldMetadata(alias="responseVariables"),
        pydantic.Field(
            alias="responseVariables",
            description="Optional for api_call type. Variables to extract from the API response",
        ),
    ] = None
    transfer_number: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="transferNumber"),
        pydantic.Field(
            alias="transferNumber", description="Required for transfer_call type. Phone number to transfer the call to"
        ),
    ] = None
    variables: typing.Optional[typing.List[SinglePromptConfigToolsItemVariablesItem]] = pydantic.Field(default=None)
    """
    Optional for extract_dynamic_variables type. Legacy field, use variablesExtractionSchema instead
    """

    variables_extraction_schema: typing_extensions.Annotated[
        typing.Optional[typing.List[SinglePromptConfigToolsItemVariablesExtractionSchemaItem]],
        FieldMetadata(alias="variablesExtractionSchema"),
        pydantic.Field(
            alias="variablesExtractionSchema",
            description="Required for extract_dynamic_variables type. Schema defining variables to extract from conversation",
        ),
    ] = None
    knowledge_base_id: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="knowledgeBaseId"),
        pydantic.Field(
            alias="knowledgeBaseId",
            description="Required for knowledge_base_search type. ID of the knowledge base to search",
        ),
    ] = None
    filler_phrases: typing_extensions.Annotated[
        typing.Optional[typing.List[str]],
        FieldMetadata(alias="fillerPhrases"),
        pydantic.Field(
            alias="fillerPhrases", description="Optional for knowledge_base_search type. Phrases to use while searching"
        ),
    ] = None

    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
