# 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 V1beta1MemoryInstancetype(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 = {
        'guest': 'K8sIoApimachineryPkgApiResourceQuantity',
        'hugepages': 'V1Hugepages',
        'max_guest': 'K8sIoApimachineryPkgApiResourceQuantity',
        'overcommit_percent': 'int'
    }

    attribute_map = {
        'guest': 'guest',
        'hugepages': 'hugepages',
        'max_guest': 'maxGuest',
        'overcommit_percent': 'overcommitPercent'
    }

    def __init__(self, guest=None, hugepages=None, max_guest=None, overcommit_percent=None, _configuration=None):  # noqa: E501
        """V1beta1MemoryInstancetype - a model defined in Swagger"""  # noqa: E501
        if _configuration is None:
            _configuration = Configuration()
        self._configuration = _configuration

        self._guest = None
        self._hugepages = None
        self._max_guest = None
        self._overcommit_percent = None
        self.discriminator = None

        self.guest = guest
        if hugepages is not None:
            self.hugepages = hugepages
        if max_guest is not None:
            self.max_guest = max_guest
        if overcommit_percent is not None:
            self.overcommit_percent = overcommit_percent

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

        Required amount of memory which is visible inside the guest OS.  # noqa: E501

        :return: The guest of this V1beta1MemoryInstancetype.  # noqa: E501
        :rtype: K8sIoApimachineryPkgApiResourceQuantity
        """
        return self._guest

    @guest.setter
    def guest(self, guest):
        """Sets the guest of this V1beta1MemoryInstancetype.

        Required amount of memory which is visible inside the guest OS.  # noqa: E501

        :param guest: The guest of this V1beta1MemoryInstancetype.  # noqa: E501
        :type: K8sIoApimachineryPkgApiResourceQuantity
        """
        if self._configuration.client_side_validation and guest is None:
            raise ValueError("Invalid value for `guest`, must not be `None`")  # noqa: E501

        self._guest = guest

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

        Optionally enables the use of hugepages for the VirtualMachineInstance instead of regular memory.  # noqa: E501

        :return: The hugepages of this V1beta1MemoryInstancetype.  # noqa: E501
        :rtype: V1Hugepages
        """
        return self._hugepages

    @hugepages.setter
    def hugepages(self, hugepages):
        """Sets the hugepages of this V1beta1MemoryInstancetype.

        Optionally enables the use of hugepages for the VirtualMachineInstance instead of regular memory.  # noqa: E501

        :param hugepages: The hugepages of this V1beta1MemoryInstancetype.  # noqa: E501
        :type: V1Hugepages
        """

        self._hugepages = hugepages

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

        MaxGuest allows to specify the maximum amount of memory which is visible inside the Guest OS. The delta between MaxGuest and Guest is the amount of memory that can be hot(un)plugged.  # noqa: E501

        :return: The max_guest of this V1beta1MemoryInstancetype.  # noqa: E501
        :rtype: K8sIoApimachineryPkgApiResourceQuantity
        """
        return self._max_guest

    @max_guest.setter
    def max_guest(self, max_guest):
        """Sets the max_guest of this V1beta1MemoryInstancetype.

        MaxGuest allows to specify the maximum amount of memory which is visible inside the Guest OS. The delta between MaxGuest and Guest is the amount of memory that can be hot(un)plugged.  # noqa: E501

        :param max_guest: The max_guest of this V1beta1MemoryInstancetype.  # noqa: E501
        :type: K8sIoApimachineryPkgApiResourceQuantity
        """

        self._max_guest = max_guest

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

        OvercommitPercent is the percentage of the guest memory which will be overcommitted. This means that the VMIs parent pod (virt-launcher) will request less physical memory by a factor specified by the OvercommitPercent. Overcommits can lead to memory exhaustion, which in turn can lead to crashes. Use carefully. Defaults to 0  # noqa: E501

        :return: The overcommit_percent of this V1beta1MemoryInstancetype.  # noqa: E501
        :rtype: int
        """
        return self._overcommit_percent

    @overcommit_percent.setter
    def overcommit_percent(self, overcommit_percent):
        """Sets the overcommit_percent of this V1beta1MemoryInstancetype.

        OvercommitPercent is the percentage of the guest memory which will be overcommitted. This means that the VMIs parent pod (virt-launcher) will request less physical memory by a factor specified by the OvercommitPercent. Overcommits can lead to memory exhaustion, which in turn can lead to crashes. Use carefully. Defaults to 0  # noqa: E501

        :param overcommit_percent: The overcommit_percent of this V1beta1MemoryInstancetype.  # noqa: E501
        :type: int
        """

        self._overcommit_percent = overcommit_percent

    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(V1beta1MemoryInstancetype, 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, V1beta1MemoryInstancetype):
            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, V1beta1MemoryInstancetype):
            return True

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