# coding: utf-8

"""
    KubeVirt API

    This is KubeVirt API an add-on for Kubernetes.  # noqa: E501

    OpenAPI spec version: 1.0.0
    Contact: kubevirt-dev@googlegroups.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


import pprint
import re  # noqa: F401

import six

from kubevirt.configuration import Configuration


class V1ResourceRequirements(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    """

    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'limits': 'dict(str, K8sIoApimachineryPkgApiResourceQuantity)',
        'overcommit_guest_overhead': 'bool',
        'requests': 'dict(str, K8sIoApimachineryPkgApiResourceQuantity)'
    }

    attribute_map = {
        'limits': 'limits',
        'overcommit_guest_overhead': 'overcommitGuestOverhead',
        'requests': 'requests'
    }

    def __init__(self, limits=None, overcommit_guest_overhead=None, requests=None, _configuration=None):  # noqa: E501
        """V1ResourceRequirements - a model defined in Swagger"""  # noqa: E501
        if _configuration is None:
            _configuration = Configuration()
        self._configuration = _configuration

        self._limits = None
        self._overcommit_guest_overhead = None
        self._requests = None
        self.discriminator = None

        if limits is not None:
            self.limits = limits
        if overcommit_guest_overhead is not None:
            self.overcommit_guest_overhead = overcommit_guest_overhead
        if requests is not None:
            self.requests = requests

    @property
    def limits(self):
        """Gets the limits of this V1ResourceRequirements.  # noqa: E501

        Limits describes the maximum amount of compute resources allowed. Valid resource keys are \"memory\" and \"cpu\".  # noqa: E501

        :return: The limits of this V1ResourceRequirements.  # noqa: E501
        :rtype: dict(str, K8sIoApimachineryPkgApiResourceQuantity)
        """
        return self._limits

    @limits.setter
    def limits(self, limits):
        """Sets the limits of this V1ResourceRequirements.

        Limits describes the maximum amount of compute resources allowed. Valid resource keys are \"memory\" and \"cpu\".  # noqa: E501

        :param limits: The limits of this V1ResourceRequirements.  # noqa: E501
        :type: dict(str, K8sIoApimachineryPkgApiResourceQuantity)
        """

        self._limits = limits

    @property
    def overcommit_guest_overhead(self):
        """Gets the overcommit_guest_overhead of this V1ResourceRequirements.  # noqa: E501

        Don't ask the scheduler to take the guest-management overhead into account. Instead put the overhead only into the container's memory limit. This can lead to crashes if all memory is in use on a node. Defaults to false.  # noqa: E501

        :return: The overcommit_guest_overhead of this V1ResourceRequirements.  # noqa: E501
        :rtype: bool
        """
        return self._overcommit_guest_overhead

    @overcommit_guest_overhead.setter
    def overcommit_guest_overhead(self, overcommit_guest_overhead):
        """Sets the overcommit_guest_overhead of this V1ResourceRequirements.

        Don't ask the scheduler to take the guest-management overhead into account. Instead put the overhead only into the container's memory limit. This can lead to crashes if all memory is in use on a node. Defaults to false.  # noqa: E501

        :param overcommit_guest_overhead: The overcommit_guest_overhead of this V1ResourceRequirements.  # noqa: E501
        :type: bool
        """

        self._overcommit_guest_overhead = overcommit_guest_overhead

    @property
    def requests(self):
        """Gets the requests of this V1ResourceRequirements.  # noqa: E501

        Requests is a description of the initial vmi resources. Valid resource keys are \"memory\" and \"cpu\".  # noqa: E501

        :return: The requests of this V1ResourceRequirements.  # noqa: E501
        :rtype: dict(str, K8sIoApimachineryPkgApiResourceQuantity)
        """
        return self._requests

    @requests.setter
    def requests(self, requests):
        """Sets the requests of this V1ResourceRequirements.

        Requests is a description of the initial vmi resources. Valid resource keys are \"memory\" and \"cpu\".  # noqa: E501

        :param requests: The requests of this V1ResourceRequirements.  # noqa: E501
        :type: dict(str, K8sIoApimachineryPkgApiResourceQuantity)
        """

        self._requests = requests

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value
        if issubclass(V1ResourceRequirements, dict):
            for key, value in self.items():
                result[key] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, V1ResourceRequirements):
            return False

        return self.to_dict() == other.to_dict()

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        if not isinstance(other, V1ResourceRequirements):
            return True

        return self.to_dict() != other.to_dict()
