# coding: utf-8

"""
    Intervals.icu API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: v1.0.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional, Union
from intervals_icu_client.models.sport_info import SportInfo
from typing import Optional, Set
from typing_extensions import Self

class Wellness(BaseModel):
    """
    Wellness
    """ # noqa: E501
    id: Optional[StrictStr] = None
    ctl: Optional[Union[StrictFloat, StrictInt]] = None
    atl: Optional[Union[StrictFloat, StrictInt]] = None
    ramp_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="rampRate")
    ctl_load: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="ctlLoad")
    atl_load: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="atlLoad")
    sport_info: Optional[List[SportInfo]] = Field(default=None, alias="sportInfo")
    updated: Optional[datetime] = None
    weight: Optional[Union[StrictFloat, StrictInt]] = None
    resting_hr: Optional[StrictInt] = Field(default=None, alias="restingHR")
    hrv: Optional[Union[StrictFloat, StrictInt]] = None
    hrv_sdnn: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="hrvSDNN")
    menstrual_phase: Optional[StrictStr] = Field(default=None, alias="menstrualPhase")
    menstrual_phase_predicted: Optional[StrictStr] = Field(default=None, alias="menstrualPhasePredicted")
    kcal_consumed: Optional[StrictInt] = Field(default=None, alias="kcalConsumed")
    sleep_secs: Optional[StrictInt] = Field(default=None, alias="sleepSecs")
    sleep_score: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="sleepScore")
    sleep_quality: Optional[StrictInt] = Field(default=None, alias="sleepQuality")
    avg_sleeping_hr: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="avgSleepingHR")
    soreness: Optional[StrictInt] = None
    fatigue: Optional[StrictInt] = None
    stress: Optional[StrictInt] = None
    mood: Optional[StrictInt] = None
    motivation: Optional[StrictInt] = None
    injury: Optional[StrictInt] = None
    sp_o2: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="spO2")
    systolic: Optional[StrictInt] = None
    diastolic: Optional[StrictInt] = None
    hydration: Optional[StrictInt] = None
    hydration_volume: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="hydrationVolume")
    readiness: Optional[Union[StrictFloat, StrictInt]] = None
    baevsky_si: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="baevskySI")
    blood_glucose: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="bloodGlucose")
    lactate: Optional[Union[StrictFloat, StrictInt]] = None
    body_fat: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="bodyFat")
    abdomen: Optional[Union[StrictFloat, StrictInt]] = None
    vo2max: Optional[Union[StrictFloat, StrictInt]] = None
    comments: Optional[StrictStr] = None
    steps: Optional[StrictInt] = None
    respiration: Optional[Union[StrictFloat, StrictInt]] = None
    locked: Optional[StrictBool] = None
    temp_weight: Optional[StrictBool] = Field(default=None, alias="tempWeight")
    temp_resting_hr: Optional[StrictBool] = Field(default=None, alias="tempRestingHR")
    __properties: ClassVar[List[str]] = ["id", "ctl", "atl", "rampRate", "ctlLoad", "atlLoad", "sportInfo", "updated", "weight", "restingHR", "hrv", "hrvSDNN", "menstrualPhase", "menstrualPhasePredicted", "kcalConsumed", "sleepSecs", "sleepScore", "sleepQuality", "avgSleepingHR", "soreness", "fatigue", "stress", "mood", "motivation", "injury", "spO2", "systolic", "diastolic", "hydration", "hydrationVolume", "readiness", "baevskySI", "bloodGlucose", "lactate", "bodyFat", "abdomen", "vo2max", "comments", "steps", "respiration", "locked", "tempWeight", "tempRestingHR"]

    @field_validator('menstrual_phase')
    def menstrual_phase_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['PERIOD', 'FOLLICULAR', 'OVULATING', 'LUTEAL', 'NONE']):
            raise ValueError("must be one of enum values ('PERIOD', 'FOLLICULAR', 'OVULATING', 'LUTEAL', 'NONE')")
        return value

    @field_validator('menstrual_phase_predicted')
    def menstrual_phase_predicted_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['PERIOD', 'FOLLICULAR', 'OVULATING', 'LUTEAL', 'NONE']):
            raise ValueError("must be one of enum values ('PERIOD', 'FOLLICULAR', 'OVULATING', 'LUTEAL', 'NONE')")
        return value

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of Wellness from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of each item in sport_info (list)
        _items = []
        if self.sport_info:
            for _item_sport_info in self.sport_info:
                if _item_sport_info:
                    _items.append(_item_sport_info.to_dict())
            _dict['sportInfo'] = _items
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of Wellness from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "id": obj.get("id"),
            "ctl": obj.get("ctl"),
            "atl": obj.get("atl"),
            "rampRate": obj.get("rampRate"),
            "ctlLoad": obj.get("ctlLoad"),
            "atlLoad": obj.get("atlLoad"),
            "sportInfo": [SportInfo.from_dict(_item) for _item in obj["sportInfo"]] if obj.get("sportInfo") is not None else None,
            "updated": obj.get("updated"),
            "weight": obj.get("weight"),
            "restingHR": obj.get("restingHR"),
            "hrv": obj.get("hrv"),
            "hrvSDNN": obj.get("hrvSDNN"),
            "menstrualPhase": obj.get("menstrualPhase"),
            "menstrualPhasePredicted": obj.get("menstrualPhasePredicted"),
            "kcalConsumed": obj.get("kcalConsumed"),
            "sleepSecs": obj.get("sleepSecs"),
            "sleepScore": obj.get("sleepScore"),
            "sleepQuality": obj.get("sleepQuality"),
            "avgSleepingHR": obj.get("avgSleepingHR"),
            "soreness": obj.get("soreness"),
            "fatigue": obj.get("fatigue"),
            "stress": obj.get("stress"),
            "mood": obj.get("mood"),
            "motivation": obj.get("motivation"),
            "injury": obj.get("injury"),
            "spO2": obj.get("spO2"),
            "systolic": obj.get("systolic"),
            "diastolic": obj.get("diastolic"),
            "hydration": obj.get("hydration"),
            "hydrationVolume": obj.get("hydrationVolume"),
            "readiness": obj.get("readiness"),
            "baevskySI": obj.get("baevskySI"),
            "bloodGlucose": obj.get("bloodGlucose"),
            "lactate": obj.get("lactate"),
            "bodyFat": obj.get("bodyFat"),
            "abdomen": obj.get("abdomen"),
            "vo2max": obj.get("vo2max"),
            "comments": obj.get("comments"),
            "steps": obj.get("steps"),
            "respiration": obj.get("respiration"),
            "locked": obj.get("locked"),
            "tempWeight": obj.get("tempWeight"),
            "tempRestingHR": obj.get("tempRestingHR")
        })
        return _obj


