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

import datetime as dt
import typing

from ...core.datetime_utils import serialize_datetime
from ...types.send_call import SendCall
from .batch_call_data import BatchCallData

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


class SendBatchRequest(SendCall):
    """
    from blandai import BatchCallData, SendBatchRequest

    SendBatchRequest(
        phone_number="29382721828",
        task="Would love for you to check out our AI API!",
        base_prompt="You are calling a business to renew their subscription to a service before it expires on a date.",
        call_data=[
            BatchCallData(
                phone_number="1234567890",
                business="ABC Corp",
                service="Netflix",
                date="September 4th",
            ),
            BatchCallData(
                phone_number="32176540987",
                business="XYZ inc.",
                service="Window Cleaning",
                date="December 20th",
            ),
        ],
        label="Subscription Renewal",
        campaign_id="1234",
        test_mode=True,
    )
    """

    base_prompt: str = pydantic.Field()
    """
    This is the prompt or task used for all the phone calls in the request.
    
    Information can be inserted into it surrounding variable names with double curly braces.
    """

    call_data: typing.List[BatchCallData] = pydantic.Field()
    """
    Define a list of calls to make and their properties.
    
    Each call in call_data **MUST** have a `phone_number` property. Properties are case-sensitive.
    """

    label: typing.Optional[str] = pydantic.Field(default=None)
    """
    Adds a user-friendly label to your batch to keep track of it's original intention. This can help differentiate multiple call batches that are part of the same Campaign. Shown when a batch is retreived.
    """

    campaign_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Use `campaign_id` to organize related batches together. This can be set manually or auto-generated through Campaigns.
    """

    test_mode: typing.Optional[bool] = pydantic.Field(default=None)
    """
    When this is set to `true`, only the first call of `call_data` will be dispatched. A common use case is to set the first `phone_number` value to your own to confirm everything's set up properly.
    
    Includes additional information in the response when true so that it's easier to find any issues.
    
    If no value is provided, `test_mode` defaults to `false`.
    """

    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
        allow_population_by_field_name = True
        json_encoders = {dt.datetime: serialize_datetime}
