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

from ..core.pydantic_utilities import UniversalBaseModel
import datetime as dt
import typing
from .vital_sleep_stage import VitalSleepStage
from .sleep_cycle_source_provider import SleepCycleSourceProvider
from .sleep_cycle_source_type import SleepCycleSourceType
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic


class SleepCycle(UniversalBaseModel):
    id: str
    sleep_id: str
    session_start: dt.datetime
    session_end: dt.datetime
    stage_start_offset_second: typing.List[int]
    stage_end_offset_second: typing.List[int]
    stage_type: typing.List[VitalSleepStage]
    time_zone: typing.Optional[str] = None
    source_provider: SleepCycleSourceProvider
    source_type: SleepCycleSourceType
    source_app_id: typing.Optional[str] = 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
