# coding: utf-8

"""
    Kubernetes

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

    The version of the OpenAPI document: release-1.29
    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 typing import Optional
from pydantic import BaseModel, Field, StrictInt, StrictStr

class V2MetricTarget(BaseModel):
    """
    MetricTarget defines the target value, average value, or average utilization of a specific metric  # noqa: E501
    """
    average_utilization: Optional[StrictInt] = Field(None, alias="averageUtilization", description="averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type")
    average_value: Optional[StrictStr] = Field(None, alias="averageValue", description="averageValue is the target value of the average of the metric across all relevant pods (as a quantity)")
    type: StrictStr = Field(..., description="type represents whether the metric type is Utilization, Value, or AverageValue")
    value: Optional[StrictStr] = Field(None, description="value is the target value of the metric (as a quantity).")
    __properties = ["averageUtilization", "averageValue", "type", "value"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

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

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> V2MetricTarget:
        """Create an instance of V2MetricTarget from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return V2MetricTarget.parse_obj(obj)

        _obj = V2MetricTarget.parse_obj({
            "average_utilization": obj.get("averageUtilization"),
            "average_value": obj.get("averageValue"),
            "type": obj.get("type"),
            "value": obj.get("value")
        })
        return _obj


