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

import datetime as dt
import typing

from ...commons.types.phone_number import PhoneNumber
from ...commons.types.tools import Tools
from ...commons.types.voice_id import VoiceId
from ...commons.types.webhook import Webhook
from ...core.datetime_utils import serialize_datetime
from .model import Model
from .voice_settings import VoiceSettings

try:
    import pydantic.v1 as pydantic  # type: ignore
except ImportError:
    import pydantic  # type: ignore


class UpdateInbound(pydantic.BaseModel):
    """
    from blandai import UpdateInbound

    UpdateInbound(
        prompt="29382721828",
        transfer_list={
            "default": "+1234567890",
            "sales": "+1234567890",
            "support": "+1234567890",
            "billing": "+1234567890",
        },
        model="enhanced",
    )
    """

    prompt: str = pydantic.Field()
    """
    Provide instructions, relevant information, and examples of the ideal conversation flow.
    
    For inbound numbers, consider including additional context about the purpose of the call, and what types of callers to expect.
    
    **Best Practices:**
    
    **Out-of-the-Box Behaviors (Summarized):**
    
    - Speech pattern: Direct, concise, casual
    - Spells out symbols, acronyms, abbreviations, percentages, etc. ($4,000,000 -> “four million dollars”)
    - Asks clarifying questions
    
    **Prompting Tips:**
    
    Want to easily test out exactly how your agent will behave?
    
    - Try out Agent Testing!
    - Aim for less than 2,000 characters where possible.
    - Simple, direct prompts are the most predictable and reliable.
    - Frame instructions positively:
      - `"Do this"` rather than `"Don't do this"`.
      - Ex. `“Keep the conversation casual”` rather than `“Don't be too formal”`.
      - This gives concrete examples of what to do, instead of leaving expected behavior open to interpretation.
    """

    transfer_list: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None)
    """
    Give your agent the ability to transfer calls to a set of phone numbers.
    
    Overrides `transfer_phone_number` if a `transfer_list.default` is specified.
    
    Will default to `transfer_list.default`, or the chosen phone number.
    """

    model: typing.Optional[Model] = pydantic.Field(default=None)
    """
    Select a model to use for your call.
    
    If no model is provided, the default value `enhanced` will be used.
    
    In nearly all cases, `enhanced` is the best choice for now.
    
    Model Differences:
    
    There are three different ways to use Bland:
    
    - `model: base`
    
      - The original, follows scripts/procedures most effectively.
      - Supports all features and capabilities.
      - Best for Custom Tools
    
    - `model: enhanced`
    
      - Much faster latency and very conversational, works best with objective-based prompts.
      - Supports all features and capabilities.
    
    - `model: turbo`
      - The absolute fastest latency possible, can be verbose at times
      - Limited capabilities currently (excludes Transferring, IVR navigation, Custom Tools)
      - Extremely realistic conversation capabilities
    """

    transfer_phone_number: typing.Optional[PhoneNumber] = pydantic.Field(default=None)
    """
    A phone number that the agent can transfer to under specific conditions - such as being asked to speak to a human or supervisor.
    
    Set to `null` to remove.
    
    Prompting Notes:
    
    - Specify conditions that the agent should transfer to a human under (examples are great!)
    - In the `task`, refer to the action solely as “transfer” or “transferring”.
    - Alternate phrasing such as “swap” or “switch” can mislead the agent, causing the action to be ignored.
    """

    voice_id: typing.Optional[VoiceId] = None
    webhook: typing.Optional[Webhook] = None
    record: typing.Optional[bool] = pydantic.Field(default=None)
    """
    To record your phone call, set record to `true`. When your call completes, you can access through the `recording_url` field in the call details or your webhook.
    
    If no value is provided, the default value `false` will be used.
    """

    first_sentence: typing.Optional[str] = pydantic.Field(default=None)
    """
    A phrase that your call will start with instead of a generating one on the fly. This works both with and without `wait_for_greeting`. Can be more than one sentence, but must be less than 200 characters.
    
    To remove, set to `null` or an empty string.
    """

    tools: Tools
    voice_settings: typing.Optional[VoiceSettings] = pydantic.Field(default=None)
    """
    Alter advanced voice settings for your agent.
    
    To remove, set to `null` or an empty string.
    """

    dynamic_data: typing.Optional[str] = pydantic.Field(default=None)
    """
    Integrate data from external APIs into your agent's knowledge.
    
    Set to `null` or an empty string to clear dynamic data settings.
    
    Detailed usage in the Send Call endpoint.
    """

    interruption_threshold: typing.Optional[int] = pydantic.Field(default=None)
    """
    How long our AI phone agent should wait in milliseconds before responding.
    
    When you increase the interruption latency, you force the AI phone agent to listen longer before responding. In practice, increasing the threshold results in less interruptions and more latency.
    
    Try setting the threshold to 500 milliseconds. You'll encounter higher latency, but you'll be interrupted less frequently.
    
    Set to `null` to reset to default.
    
    If no value is provided, the default value `50` will be used.
    """

    max_duration: typing.Optional[int] = pydantic.Field(default=None)
    """
    The maximum duration in minutes that calls to your agent can last before being automatically terminated.
    
    Set to `null` to reset to default.
    
    If no value is provided, the default value `30` will be used.
    """

    def json(self, **kwargs: typing.Any) -> str:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().json(**kwargs_with_defaults)

    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().dict(**kwargs_with_defaults)

    class Config:
        frozen = True
        smart_union = True
        json_encoders = {dt.datetime: serialize_datetime}
