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

import typing

import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.unchecked_base_model import UncheckedBaseModel
from .list_telephony_response_data_list_item_state import ListTelephonyResponseDataListItemState
from .list_telephony_response_data_list_item_type import ListTelephonyResponseDataListItemType


class ListTelephonyResponseDataListItem(UncheckedBaseModel):
    to_number: typing.Optional[str] = pydantic.Field(default=None)
    """
    The number called.
    """

    from_number: typing.Optional[str] = pydantic.Field(default=None)
    """
    Caller ID.
    """

    pipeline_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The unique ID of a published project in AI Studio. Can be obtained in AI Studio - Project - Release Management.
    """

    type: typing.Optional[ListTelephonyResponseDataListItemType] = pydantic.Field(default=None)
    """
    Call type:
    - `inbound`: Inbound call.
    - `outbound`: Outbound call.
    """

    agent_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    A unique identifier for the call session.
    """

    channel: typing.Optional[str] = pydantic.Field(default=None)
    """
    RTC channel name.
    """

    create_ts: typing.Optional[int] = pydantic.Field(default=None)
    """
    Call creation timestamp (in seconds).
    """

    state: typing.Optional[ListTelephonyResponseDataListItemState] = pydantic.Field(default=None)
    """
    Call status:
    - `answered`: The call was answered.
    - `hangup`: The call was disconnected.
    """

    stop_ts: typing.Optional[int] = pydantic.Field(default=None)
    """
    Call end timestamp (in seconds). Returns `0` or `null` if the call has not ended.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
