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

import datetime as dt
import typing

from ...commons.types.status import Status
from ...core.datetime_utils import serialize_datetime

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


class AudioRecordingResponse(pydantic.BaseModel):
    status: Status
    message: typing.Optional[str] = pydantic.Field(default=None)
    """
    If the status is `success`, the `url` field will be present instead of this field.
    
    A 404 error will be returned if the call does not exist or the recording is not available. We can only retrieve recordings if the call was created with `record` set to `true`.
    
    A 400/500 error will be returned if there is an error retrieving the recording.
    """

    url: typing.Optional[str] = pydantic.Field(default=None)
    """
    If the status is `success`, the `url` will provide the exact location of the MP3 file storing the call's audio.
    """

    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}
