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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .create_agent_request_audio_format import CreateAgentRequestAudioFormat
from .create_agent_request_background_noise import CreateAgentRequestBackgroundNoise
from .create_agent_request_configuration_endpoint import CreateAgentRequestConfigurationEndpoint
from .create_agent_request_template_variables_value import CreateAgentRequestTemplateVariablesValue
from .create_agent_request_tools_item import CreateAgentRequestToolsItem
from .language_code import LanguageCode
from .task import Task


class CreateAgentRequest(UniversalBaseModel):
    name: str = pydantic.Field()
    """
    The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project.
    """

    phone_number: typing.Optional[typing.Literal["assign-automatically"]] = None
    timezone: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timezone of the agent. Used to format system variables like `{{system_time}}`.
    """

    voice_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The voice ID to use.
    """

    audio_format: typing.Optional[CreateAgentRequestAudioFormat] = pydantic.Field(default=None)
    """
    The audio format of the agent.
    """

    audio_speed: typing.Optional[float] = pydantic.Field(default=None)
    """
    The audio speed of the agent.
    """

    background_noise_level: typing.Optional[float] = pydantic.Field(default=None)
    """
    The background noise level of the agent.
    """

    background_noise: typing.Optional[CreateAgentRequestBackgroundNoise] = pydantic.Field(default=None)
    """
    The background noise type. Can be "office", "call-center", "coffee-shop", or null.
    """

    welcome_message: typing.Optional[str] = pydantic.Field(default=None)
    """
    Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`.
    """

    system_prompt: typing.Optional[str] = pydantic.Field(default=None)
    """
    Instructions for the conversation. Can contain template variables like `{{subject}}`.
    """

    template_variables: typing.Optional[typing.Dict[str, CreateAgentRequestTemplateVariablesValue]] = pydantic.Field(
        default=None
    )
    """
    Variables that can be used in the welcome message and the system prompt.
    """

    tools: typing.Optional[typing.List[CreateAgentRequestToolsItem]] = pydantic.Field(default=None)
    """
    Array of built-in or custom tool names to use.
    """

    tasks: typing.Optional[typing.List[Task]] = pydantic.Field(default=None)
    """
    Array of task objects with `name` and `description` fields.
    """

    no_input_poke_sec: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of seconds of silence before sending a poke message. `null` disables the poke message.
    """

    no_input_poke_text: typing.Optional[str] = pydantic.Field(default=None)
    """
    The message to send after the specified silence.
    """

    no_input_end_conversation_sec: typing.Optional[int] = pydantic.Field(default=None)
    """
    Seconds of silence before ending the conversation.
    """

    languages: typing.Optional[typing.List[LanguageCode]] = pydantic.Field(default=None)
    """
    Array of ISO 639-1 language codes that the agent should be able to recognize
    """

    boosted_keywords: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    These words, or short phrases, will be more accurately recognized by the agent.
    """

    configuration_endpoint: typing.Optional[CreateAgentRequestConfigurationEndpoint] = pydantic.Field(default=None)
    """
    When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint when to get configuration options.
    """

    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
