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

from ..core.pydantic_utilities import UniversalBaseModel
import datetime as dt
import typing
from .client_facing_electrocardiogram_classification import ClientFacingElectrocardiogramClassification
from .client_facing_electrocardiogram_inconclusive_cause import ClientFacingElectrocardiogramInconclusiveCause
from .client_facing_electrocardiogram_source_provider import ClientFacingElectrocardiogramSourceProvider
from .client_facing_electrocardiogram_source_type import ClientFacingElectrocardiogramSourceType
from .client_facing_source import ClientFacingSource
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic


class ClientFacingElectrocardiogram(UniversalBaseModel):
    id: str
    session_start: dt.datetime
    session_end: dt.datetime
    voltage_sample_count: int
    heart_rate_mean: typing.Optional[int] = None
    sampling_frequency_hz: typing.Optional[float] = None
    classification: typing.Optional[ClientFacingElectrocardiogramClassification] = None
    inconclusive_cause: typing.Optional[ClientFacingElectrocardiogramInconclusiveCause] = None
    algorithm_version: typing.Optional[str] = None
    time_zone: typing.Optional[str] = None
    source_provider: ClientFacingElectrocardiogramSourceProvider
    source_type: ClientFacingElectrocardiogramSourceType
    source_app_id: typing.Optional[str] = None
    source_device_model: typing.Optional[str] = None
    user_id: str
    source: ClientFacingSource

    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
