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

import typing

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


class DiarizeResponse(UniversalBaseModel):
    """
    Response from the diarization endpoint.
    """

    segments: typing.List[typing.Dict[str, typing.Any]] = pydantic.Field()
    """
    Speaker segments with speaker label, start, and end times
    """

    speaker_count: int = pydantic.Field()
    """
    Number of distinct speakers detected
    """

    overlap_segments: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic.Field(default=None)
    """
    Segments where multiple speakers overlap
    """

    total_speech_seconds: float = pydantic.Field()
    """
    Total speech duration in seconds
    """

    overlap_ratio: float = pydantic.Field()
    """
    Ratio of overlapping speech to total speech
    """

    processing_time_seconds: float = pydantic.Field()
    """
    Server-side processing time in seconds
    """

    model: str = pydantic.Field()
    """
    Model used for diarization
    """

    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
