"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""

from __future__ import annotations
import dataclasses
from dataclasses_json import Undefined, dataclass_json
from enum import Enum
from retellclient import utils
from typing import Dict, List, Optional

class CallStatus(str, Enum):
    r"""Status of call."""
    ONGOING = 'ongoing'
    REGISTERED = 'registered'
    ENDED = 'ended'
    ERROR = 'error'

class AudioEncoding(str, Enum):
    r"""The audio encoding of the call."""
    S16LE = "s16le"
    MULAW = "mulaw"

class AudioWebsocketProtocol(str, Enum):
    r"""The protocol how audio websocket read and send audio bytes."""
    WEB = "web"
    TWILIO = "twilio"
    VONAGE = "vonage"


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class CallDetail:
    agent_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('agent_id') }})
    r"""Corresponding agent id of this call."""
    audio_encoding: AudioEncoding = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('audio_encoding') }})
    r"""The audio encoding of the call."""
    audio_websocket_protocol: AudioWebsocketProtocol = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('audio_websocket_protocol') }})
    r"""The protocol how audio websocket read and send audio bytes."""
    call_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('call_id') }})
    r"""Unique id of the call."""
    call_status: CallStatus = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('call_status') }})
    r"""Status of call."""
    sample_rate: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('sample_rate') }})
    r"""Sample rate of the conversation, the input and output audio bytes will all conform to this rate."""
    start_timestamp: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('start_timestamp') }})
    r"""Begin timestamp (milliseconds since epoch) of the call."""
    end_timestamp: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_timestamp'), 'exclude': lambda f: f is None }})
    r"""End timestamp (milliseconds since epoch) of the call. Available after call ends."""
    recording_url: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('recording_url'), 'exclude': lambda f: f is None }})
    r"""Recording of the call. Available after call ends."""
    transcript: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('transcript'), 'exclude': lambda f: f is None }})
    r"""Transcription of the call. Available after call ends."""
    end_call_after_silence_ms: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_timestamp'), 'exclude': lambda f: f is None }})
    r"""If users stay silent for a period, end the call. By default, it is set to 600,000 ms (10 min). The minimum value allowed is 10,000 ms (10 s)."""
    from_number: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('from_number'), 'exclude': lambda f: f is None }})
    r"""The callee number. This field is storage purpose only, set this if you want the call object to contain it so that it's easier to reference it. Not used for processing, when we connect to your LLM websocket server, you can then get it from the call object."""
    to_number: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('to_number'), 'exclude': lambda f: f is None }})
    r"""The caller number. This field is storage purpose only, set this if you want the call object to contain it so that it's easier to reference it. Not used for processing, when we connect to your LLM websocket server, you can then get it from the call object."""
    metadata: Optional[Dict[str, any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('metadata'), 'exclude': lambda f: f is None }})
    r"""An abtriary object for storage purpose only. You can put anything here like your own id for the call, twilio SID, internal customer id. Not used for processing, when we connect to your LLM websocket server, you can then get it from the call object."""

    

