"""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 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."""
    

