# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Dict, Union, Iterable, Optional
from datetime import datetime
from typing_extensions import Required, Annotated, TypedDict

from .._utils import PropertyInfo

__all__ = ["CampaignCreateParams", "Contact", "CallRetryConfig", "CallRetryConfigCallingWindow"]


class CampaignCreateParams(TypedDict, total=False):
    assistant_id: Required[str]
    """The ID of the assistant to use"""

    contacts: Required[Iterable[Contact]]
    """The list of contacts to call"""

    name: Required[str]
    """The name of the campaign"""

    call_retry_config: CallRetryConfig
    """Override retry configuration for calls in this campaign.

    If not provided, uses the assistant's retry config.
    """

    from_phone_number: str
    """The phone number to use for outbound calls (E.164 format, e.g., +1234567890)"""

    max_concurrent_calls: float
    """Maximum number of concurrent calls allowed for this campaign"""

    scheduled_at: Annotated[Union[Union[str, datetime], object], PropertyInfo(format="iso8601")]
    """
    Schedule all calls in this campaign to start at a specific date and time (ISO
    8601 format)
    """


class Contact(TypedDict, total=False):
    prompt_variables: Required[Dict[str, str]]

    to_phone_number: Required[str]


class CallRetryConfigCallingWindow(TypedDict, total=False):
    calling_window_end_time: Required[str]
    """
    End time for the calling window in the recipient's timezone (or
    timezone_override if provided). Format: 'HH:mm' (24-hour) or 'H:mma' (12-hour).
    Examples: '17:00', '6pm'. Default: '18:00'.
    """

    calling_window_start_time: Required[str]
    """
    Start time for the calling window in the recipient's timezone (or
    timezone_override if provided). Format: 'HH:mm' (24-hour) or 'H:mma' (12-hour).
    Examples: '09:00', '10am'. Default: '10:00'.
    """

    retry_delay_seconds: Required[int]
    """Delay between retry attempts in seconds. Default: 7200 (2 hours)."""


class CallRetryConfig(TypedDict, total=False):
    """Override retry configuration for calls in this campaign.

    If not provided, uses the assistant's retry config.
    """

    calling_windows: Required[Iterable[CallRetryConfigCallingWindow]]

    max_retry_attempts: Required[int]
    """Maximum number of call retry attempts. Default: 3."""

    timezone: Optional[str]
    """
    Optional IANA timezone identifier to override the automatic timezone detection
    from phone number. If not provided, timezone is determined from the recipient's
    phone number country code. Examples: 'America/New_York', 'Europe/Paris'.
    """
