# 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, Field, StrictBool, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class ActivityFilter(BaseModel):
    """
    ActivityFilter
    """ # noqa: E501
    id: Optional[StrictInt] = None
    field_id: Optional[StrictStr] = None
    code: Optional[StrictStr] = None
    operator: Optional[StrictStr] = None
    value: Optional[Dict[str, Any]] = None
    var_not: Optional[StrictBool] = Field(default=None, alias="not")
    __properties: ClassVar[List[str]] = ["id", "field_id", "code", "operator", "value", "not"]

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

        if value not in set(['type', 'indoor', 'name', 'notName', 'description', 'moving_time', 'elapsed_time', 'coasting_time', 'distance', 'climbing', 'load', 'source', 'race', 'average_heartrate', 'max_heartrate', 'hrrc', 'average_power', 'norm_power', 'pace', 'gap', 'average_speed', 'max_speed', 'variability_index', 'intensity', 'average_cadence', 'average_cadence_z2', 'average_temp', 'calories', 'work', 'work_above_ftp', 'max_wbal_depletion', 'efficiency', 'power_hr', 'power_hr_z2', 'power_hr_z2_mins', 'rpe', 'feel', 'session_rpe', 'kg_lifted', 'power_meter', 'power_meter_serial', 'gear_name', 'trimp', 'custom', 'tags', 'device_name', 'compliance', 'polarization_index', 'day_of_week', 'average_altitude', 'min_altitude', 'max_altitude', 'start_time', 'route_id']):
            raise ValueError("must be one of enum values ('type', 'indoor', 'name', 'notName', 'description', 'moving_time', 'elapsed_time', 'coasting_time', 'distance', 'climbing', 'load', 'source', 'race', 'average_heartrate', 'max_heartrate', 'hrrc', 'average_power', 'norm_power', 'pace', 'gap', 'average_speed', 'max_speed', 'variability_index', 'intensity', 'average_cadence', 'average_cadence_z2', 'average_temp', 'calories', 'work', 'work_above_ftp', 'max_wbal_depletion', 'efficiency', 'power_hr', 'power_hr_z2', 'power_hr_z2_mins', 'rpe', 'feel', 'session_rpe', 'kg_lifted', 'power_meter', 'power_meter_serial', 'gear_name', 'trimp', 'custom', 'tags', 'device_name', 'compliance', 'polarization_index', 'day_of_week', 'average_altitude', 'min_altitude', 'max_altitude', 'start_time', 'route_id')")
        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 ActivityFilter 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 ActivityFilter 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"),
            "field_id": obj.get("field_id"),
            "code": obj.get("code"),
            "operator": obj.get("operator"),
            "value": obj.get("value"),
            "not": obj.get("not")
        })
        return _obj


