# generated by datamodel-codegen:
#   filename:  sleep.json
#   timestamp: 2021-10-31T18:17:20+00:00

from __future__ import annotations

from typing import List, Optional

from pydantic import BaseModel


class MinuteDatum(BaseModel):
    dateTime: str
    value: str


class SleepItem(BaseModel):
    awakeCount: int
    awakeDuration: int
    awakeningsCount: int
    dateOfSleep: str
    duration: int
    efficiency: int
    endTime: str
    isMainSleep: bool
    logId: int
    minuteData: List[MinuteDatum]
    minutesAfterWakeup: int
    minutesAsleep: int
    minutesAwake: int
    minutesToFallAsleep: int
    restlessCount: int
    restlessDuration: int
    startTime: str
    timeInBed: int


class Stages(BaseModel):
    deep: int
    light: int
    rem: int
    wake: int


class Summary(BaseModel):
    # TODO: Set this to optional dynamically
    stages: Optional[Stages]
    totalMinutesAsleep: int
    totalSleepRecords: int
    totalTimeInBed: int


class SleepResponse(BaseModel):
    sleep: List[SleepItem]
    summary: Summary
