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

import datetime as dt
import typing

import pydantic
import typing_extensions
from ....core.pydantic_utilities import IS_PYDANTIC_V2
from ....core.serialization import FieldMetadata
from ....core.unchecked_base_model import UncheckedBaseModel
from .get_conversation_response_data_logs_item_agent_disposition_config_item import (
    GetConversationResponseDataLogsItemAgentDispositionConfigItem,
)
from .get_conversation_response_data_logs_item_status import GetConversationResponseDataLogsItemStatus
from .get_conversation_response_data_logs_item_type import GetConversationResponseDataLogsItemType


class GetConversationResponseDataLogsItem(UncheckedBaseModel):
    id: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="_id"),
        pydantic.Field(alias="_id", description="The database ID of the call log"),
    ] = None
    call_id: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="callId"),
        pydantic.Field(alias="callId", description="The unique call identifier"),
    ] = None
    status: typing.Optional[GetConversationResponseDataLogsItemStatus] = pydantic.Field(default=None)
    """
    The status of the call
    """

    duration: typing.Optional[float] = pydantic.Field(default=None)
    """
    The duration of the call in seconds
    """

    from_: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="from"),
        pydantic.Field(alias="from", description="The phone number the call was made from"),
    ] = None
    to: typing.Optional[str] = pydantic.Field(default=None)
    """
    The phone number the call was made to
    """

    type: typing.Optional[GetConversationResponseDataLogsItemType] = pydantic.Field(default=None)
    """
    The type of call
    """

    agent_id: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="agentId"),
        pydantic.Field(alias="agentId", description="The ID of the agent that handled the call"),
    ] = None
    agent_name: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="agentName"),
        pydantic.Field(alias="agentName", description="The name of the agent"),
    ] = None
    recording_url: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="recordingUrl"),
        pydantic.Field(alias="recordingUrl", description="URL to the call recording (if available)"),
    ] = None
    recording_dual_url: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="recordingDualUrl"),
        pydantic.Field(alias="recordingDualUrl", description="URL to the dual-channel call recording (if available)"),
    ] = None
    disconnection_reason: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="disconnectionReason"),
        pydantic.Field(alias="disconnectionReason", description="The reason the call was disconnected"),
    ] = None
    retry_count: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="retryCount"),
        pydantic.Field(alias="retryCount", description="Number of retry attempts for this call"),
    ] = None
    created_at: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="createdAt"),
        pydantic.Field(alias="createdAt", description="When the call was created"),
    ] = None
    disposition_metrics: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, str]],
        FieldMetadata(alias="dispositionMetrics"),
        pydantic.Field(alias="dispositionMetrics", description="Custom disposition metrics for the call"),
    ] = None
    agent_disposition_config: typing_extensions.Annotated[
        typing.Optional[typing.List[GetConversationResponseDataLogsItemAgentDispositionConfigItem]],
        FieldMetadata(alias="agentDispositionConfig"),
        pydantic.Field(alias="agentDispositionConfig", description="Configuration for disposition metrics"),
    ] = None

    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
