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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .conversation_item_role import ConversationItemRole


class ConversationItem(UniversalBaseModel):
    item_idx: int = pydantic.Field()
    """
    Index of the item in the conversation.
    """

    role: ConversationItemRole = pydantic.Field()
    """
    Who spoke in this turn.
    """

    live_transcript: str = pydantic.Field()
    """
    Live transcript of this turn.
    """

    post_call_transcript: typing.Optional[str] = pydantic.Field(default=None)
    """
    Post-call processed transcript.
    """

    duration_ms: float = pydantic.Field()
    """
    Duration of this turn in milliseconds.
    """

    started_at: dt.datetime = pydantic.Field()
    """
    When this turn started.
    """

    system_prompt: typing.Optional[str] = pydantic.Field(default=None)
    """
    System prompt used (assistant only).
    """

    voice_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Voice ID used (assistant only).
    """

    audio_speed: typing.Optional[float] = pydantic.Field(default=None)
    """
    Audio speed used (assistant only).
    """

    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
