# 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 pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self

class IntervalGroup(BaseModel):
    """
    IntervalGroup
    """ # noqa: E501
    start_index: Optional[StrictInt] = None
    distance: Optional[Union[StrictFloat, StrictInt]] = None
    moving_time: Optional[StrictInt] = None
    elapsed_time: Optional[StrictInt] = None
    average_watts: Optional[StrictInt] = None
    average_watts_alt: Optional[StrictInt] = None
    average_watts_alt_acc: Optional[StrictInt] = None
    min_watts: Optional[StrictInt] = None
    max_watts: Optional[StrictInt] = None
    average_watts_kg: Optional[Union[StrictFloat, StrictInt]] = None
    max_watts_kg: Optional[Union[StrictFloat, StrictInt]] = None
    intensity: Optional[StrictInt] = None
    w5s_variability: Optional[Union[StrictFloat, StrictInt]] = None
    weighted_average_watts: Optional[StrictInt] = None
    training_load: Optional[Union[StrictFloat, StrictInt]] = None
    joules: Optional[StrictInt] = None
    joules_above_ftp: Optional[StrictInt] = None
    decoupling: Optional[Union[StrictFloat, StrictInt]] = None
    avg_lr_balance: Optional[Union[StrictFloat, StrictInt]] = None
    average_dfa_a1: Optional[Union[StrictFloat, StrictInt]] = None
    average_epoc: Optional[Union[StrictFloat, StrictInt]] = None
    wbal_start: Optional[StrictInt] = None
    wbal_end: Optional[StrictInt] = None
    average_respiration: Optional[Union[StrictFloat, StrictInt]] = None
    average_tidal_volume: Optional[Union[StrictFloat, StrictInt]] = None
    average_tidal_volume_min: Optional[Union[StrictFloat, StrictInt]] = None
    zone: Optional[StrictInt] = None
    zone_min_watts: Optional[StrictInt] = None
    zone_max_watts: Optional[StrictInt] = None
    average_speed: Optional[Union[StrictFloat, StrictInt]] = None
    min_speed: Optional[Union[StrictFloat, StrictInt]] = None
    max_speed: Optional[Union[StrictFloat, StrictInt]] = None
    gap: Optional[Union[StrictFloat, StrictInt]] = None
    average_heartrate: Optional[StrictInt] = None
    min_heartrate: Optional[StrictInt] = None
    max_heartrate: Optional[StrictInt] = None
    average_cadence: Optional[Union[StrictFloat, StrictInt]] = None
    min_cadence: Optional[StrictInt] = None
    max_cadence: Optional[StrictInt] = None
    average_torque: Optional[Union[StrictFloat, StrictInt]] = None
    min_torque: Optional[Union[StrictFloat, StrictInt]] = None
    max_torque: Optional[Union[StrictFloat, StrictInt]] = None
    total_elevation_gain: Optional[Union[StrictFloat, StrictInt]] = None
    min_altitude: Optional[Union[StrictFloat, StrictInt]] = None
    max_altitude: Optional[Union[StrictFloat, StrictInt]] = None
    average_gradient: Optional[Union[StrictFloat, StrictInt]] = None
    average_smo2: Optional[Union[StrictFloat, StrictInt]] = None
    average_thb: Optional[Union[StrictFloat, StrictInt]] = None
    average_smo2_2: Optional[Union[StrictFloat, StrictInt]] = None
    average_thb_2: Optional[Union[StrictFloat, StrictInt]] = None
    average_temp: Optional[Union[StrictFloat, StrictInt]] = None
    average_weather_temp: Optional[Union[StrictFloat, StrictInt]] = None
    average_feels_like: Optional[Union[StrictFloat, StrictInt]] = None
    average_wind_speed: Optional[Union[StrictFloat, StrictInt]] = None
    average_wind_gust: Optional[Union[StrictFloat, StrictInt]] = None
    prevailing_wind_deg: Optional[StrictInt] = None
    average_yaw: Optional[Union[StrictFloat, StrictInt]] = None
    headwind_percent: Optional[Union[StrictFloat, StrictInt]] = None
    tailwind_percent: Optional[Union[StrictFloat, StrictInt]] = None
    strain_score: Optional[Union[StrictFloat, StrictInt]] = None
    ss_p_max: Optional[Union[StrictFloat, StrictInt]] = None
    ss_w_prime: Optional[Union[StrictFloat, StrictInt]] = None
    ss_cp: Optional[Union[StrictFloat, StrictInt]] = None
    id: Optional[StrictStr] = None
    count: Optional[StrictInt] = None
    average_stride: Optional[Union[StrictFloat, StrictInt]] = None
    __properties: ClassVar[List[str]] = ["start_index", "distance", "moving_time", "elapsed_time", "average_watts", "average_watts_alt", "average_watts_alt_acc", "min_watts", "max_watts", "average_watts_kg", "max_watts_kg", "intensity", "w5s_variability", "weighted_average_watts", "training_load", "joules", "joules_above_ftp", "decoupling", "avg_lr_balance", "average_dfa_a1", "average_epoc", "wbal_start", "wbal_end", "average_respiration", "average_tidal_volume", "average_tidal_volume_min", "zone", "zone_min_watts", "zone_max_watts", "average_speed", "min_speed", "max_speed", "gap", "average_heartrate", "min_heartrate", "max_heartrate", "average_cadence", "min_cadence", "max_cadence", "average_torque", "min_torque", "max_torque", "total_elevation_gain", "min_altitude", "max_altitude", "average_gradient", "average_smo2", "average_thb", "average_smo2_2", "average_thb_2", "average_temp", "average_weather_temp", "average_feels_like", "average_wind_speed", "average_wind_gust", "prevailing_wind_deg", "average_yaw", "headwind_percent", "tailwind_percent", "strain_score", "ss_p_max", "ss_w_prime", "ss_cp", "id", "count", "average_stride"]

    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 IntervalGroup 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,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "start_index": obj.get("start_index"),
            "distance": obj.get("distance"),
            "moving_time": obj.get("moving_time"),
            "elapsed_time": obj.get("elapsed_time"),
            "average_watts": obj.get("average_watts"),
            "average_watts_alt": obj.get("average_watts_alt"),
            "average_watts_alt_acc": obj.get("average_watts_alt_acc"),
            "min_watts": obj.get("min_watts"),
            "max_watts": obj.get("max_watts"),
            "average_watts_kg": obj.get("average_watts_kg"),
            "max_watts_kg": obj.get("max_watts_kg"),
            "intensity": obj.get("intensity"),
            "w5s_variability": obj.get("w5s_variability"),
            "weighted_average_watts": obj.get("weighted_average_watts"),
            "training_load": obj.get("training_load"),
            "joules": obj.get("joules"),
            "joules_above_ftp": obj.get("joules_above_ftp"),
            "decoupling": obj.get("decoupling"),
            "avg_lr_balance": obj.get("avg_lr_balance"),
            "average_dfa_a1": obj.get("average_dfa_a1"),
            "average_epoc": obj.get("average_epoc"),
            "wbal_start": obj.get("wbal_start"),
            "wbal_end": obj.get("wbal_end"),
            "average_respiration": obj.get("average_respiration"),
            "average_tidal_volume": obj.get("average_tidal_volume"),
            "average_tidal_volume_min": obj.get("average_tidal_volume_min"),
            "zone": obj.get("zone"),
            "zone_min_watts": obj.get("zone_min_watts"),
            "zone_max_watts": obj.get("zone_max_watts"),
            "average_speed": obj.get("average_speed"),
            "min_speed": obj.get("min_speed"),
            "max_speed": obj.get("max_speed"),
            "gap": obj.get("gap"),
            "average_heartrate": obj.get("average_heartrate"),
            "min_heartrate": obj.get("min_heartrate"),
            "max_heartrate": obj.get("max_heartrate"),
            "average_cadence": obj.get("average_cadence"),
            "min_cadence": obj.get("min_cadence"),
            "max_cadence": obj.get("max_cadence"),
            "average_torque": obj.get("average_torque"),
            "min_torque": obj.get("min_torque"),
            "max_torque": obj.get("max_torque"),
            "total_elevation_gain": obj.get("total_elevation_gain"),
            "min_altitude": obj.get("min_altitude"),
            "max_altitude": obj.get("max_altitude"),
            "average_gradient": obj.get("average_gradient"),
            "average_smo2": obj.get("average_smo2"),
            "average_thb": obj.get("average_thb"),
            "average_smo2_2": obj.get("average_smo2_2"),
            "average_thb_2": obj.get("average_thb_2"),
            "average_temp": obj.get("average_temp"),
            "average_weather_temp": obj.get("average_weather_temp"),
            "average_feels_like": obj.get("average_feels_like"),
            "average_wind_speed": obj.get("average_wind_speed"),
            "average_wind_gust": obj.get("average_wind_gust"),
            "prevailing_wind_deg": obj.get("prevailing_wind_deg"),
            "average_yaw": obj.get("average_yaw"),
            "headwind_percent": obj.get("headwind_percent"),
            "tailwind_percent": obj.get("tailwind_percent"),
            "strain_score": obj.get("strain_score"),
            "ss_p_max": obj.get("ss_p_max"),
            "ss_w_prime": obj.get("ss_w_prime"),
            "ss_cp": obj.get("ss_cp"),
            "id": obj.get("id"),
            "count": obj.get("count"),
            "average_stride": obj.get("average_stride")
        })
        return _obj


