# 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 V1CPU(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 = {
        'cores': 'int',
        'dedicated_cpu_placement': 'bool',
        'features': 'list[V1CPUFeature]',
        'isolate_emulator_thread': 'bool',
        'max_sockets': 'int',
        'model': 'str',
        'numa': 'V1NUMA',
        'realtime': 'V1Realtime',
        'sockets': 'int',
        'threads': 'int'
    }

    attribute_map = {
        'cores': 'cores',
        'dedicated_cpu_placement': 'dedicatedCpuPlacement',
        'features': 'features',
        'isolate_emulator_thread': 'isolateEmulatorThread',
        'max_sockets': 'maxSockets',
        'model': 'model',
        'numa': 'numa',
        'realtime': 'realtime',
        'sockets': 'sockets',
        'threads': 'threads'
    }

    def __init__(self, cores=None, dedicated_cpu_placement=None, features=None, isolate_emulator_thread=None, max_sockets=None, model=None, numa=None, realtime=None, sockets=None, threads=None, _configuration=None):  # noqa: E501
        """V1CPU - a model defined in Swagger"""  # noqa: E501
        if _configuration is None:
            _configuration = Configuration()
        self._configuration = _configuration

        self._cores = None
        self._dedicated_cpu_placement = None
        self._features = None
        self._isolate_emulator_thread = None
        self._max_sockets = None
        self._model = None
        self._numa = None
        self._realtime = None
        self._sockets = None
        self._threads = None
        self.discriminator = None

        if cores is not None:
            self.cores = cores
        if dedicated_cpu_placement is not None:
            self.dedicated_cpu_placement = dedicated_cpu_placement
        if features is not None:
            self.features = features
        if isolate_emulator_thread is not None:
            self.isolate_emulator_thread = isolate_emulator_thread
        if max_sockets is not None:
            self.max_sockets = max_sockets
        if model is not None:
            self.model = model
        if numa is not None:
            self.numa = numa
        if realtime is not None:
            self.realtime = realtime
        if sockets is not None:
            self.sockets = sockets
        if threads is not None:
            self.threads = threads

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

        Cores specifies the number of cores inside the vmi. Must be a value greater or equal 1.  # noqa: E501

        :return: The cores of this V1CPU.  # noqa: E501
        :rtype: int
        """
        return self._cores

    @cores.setter
    def cores(self, cores):
        """Sets the cores of this V1CPU.

        Cores specifies the number of cores inside the vmi. Must be a value greater or equal 1.  # noqa: E501

        :param cores: The cores of this V1CPU.  # noqa: E501
        :type: int
        """

        self._cores = cores

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

        DedicatedCPUPlacement requests the scheduler to place the VirtualMachineInstance on a node with enough dedicated pCPUs and pin the vCPUs to it.  # noqa: E501

        :return: The dedicated_cpu_placement of this V1CPU.  # noqa: E501
        :rtype: bool
        """
        return self._dedicated_cpu_placement

    @dedicated_cpu_placement.setter
    def dedicated_cpu_placement(self, dedicated_cpu_placement):
        """Sets the dedicated_cpu_placement of this V1CPU.

        DedicatedCPUPlacement requests the scheduler to place the VirtualMachineInstance on a node with enough dedicated pCPUs and pin the vCPUs to it.  # noqa: E501

        :param dedicated_cpu_placement: The dedicated_cpu_placement of this V1CPU.  # noqa: E501
        :type: bool
        """

        self._dedicated_cpu_placement = dedicated_cpu_placement

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

        Features specifies the CPU features list inside the VMI.  # noqa: E501

        :return: The features of this V1CPU.  # noqa: E501
        :rtype: list[V1CPUFeature]
        """
        return self._features

    @features.setter
    def features(self, features):
        """Sets the features of this V1CPU.

        Features specifies the CPU features list inside the VMI.  # noqa: E501

        :param features: The features of this V1CPU.  # noqa: E501
        :type: list[V1CPUFeature]
        """

        self._features = features

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

        IsolateEmulatorThread requests one more dedicated pCPU to be allocated for the VMI to place the emulator thread on it.  # noqa: E501

        :return: The isolate_emulator_thread of this V1CPU.  # noqa: E501
        :rtype: bool
        """
        return self._isolate_emulator_thread

    @isolate_emulator_thread.setter
    def isolate_emulator_thread(self, isolate_emulator_thread):
        """Sets the isolate_emulator_thread of this V1CPU.

        IsolateEmulatorThread requests one more dedicated pCPU to be allocated for the VMI to place the emulator thread on it.  # noqa: E501

        :param isolate_emulator_thread: The isolate_emulator_thread of this V1CPU.  # noqa: E501
        :type: bool
        """

        self._isolate_emulator_thread = isolate_emulator_thread

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

        MaxSockets specifies the maximum amount of sockets that can be hotplugged  # noqa: E501

        :return: The max_sockets of this V1CPU.  # noqa: E501
        :rtype: int
        """
        return self._max_sockets

    @max_sockets.setter
    def max_sockets(self, max_sockets):
        """Sets the max_sockets of this V1CPU.

        MaxSockets specifies the maximum amount of sockets that can be hotplugged  # noqa: E501

        :param max_sockets: The max_sockets of this V1CPU.  # noqa: E501
        :type: int
        """

        self._max_sockets = max_sockets

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

        Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map. It is possible to specify special cases like \"host-passthrough\" to get the same CPU as the node and \"host-model\" to get CPU closest to the node one. Defaults to host-model.  # noqa: E501

        :return: The model of this V1CPU.  # noqa: E501
        :rtype: str
        """
        return self._model

    @model.setter
    def model(self, model):
        """Sets the model of this V1CPU.

        Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map. It is possible to specify special cases like \"host-passthrough\" to get the same CPU as the node and \"host-model\" to get CPU closest to the node one. Defaults to host-model.  # noqa: E501

        :param model: The model of this V1CPU.  # noqa: E501
        :type: str
        """

        self._model = model

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

        NUMA allows specifying settings for the guest NUMA topology  # noqa: E501

        :return: The numa of this V1CPU.  # noqa: E501
        :rtype: V1NUMA
        """
        return self._numa

    @numa.setter
    def numa(self, numa):
        """Sets the numa of this V1CPU.

        NUMA allows specifying settings for the guest NUMA topology  # noqa: E501

        :param numa: The numa of this V1CPU.  # noqa: E501
        :type: V1NUMA
        """

        self._numa = numa

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

        Realtime instructs the virt-launcher to tune the VMI for lower latency, optional for real time workloads  # noqa: E501

        :return: The realtime of this V1CPU.  # noqa: E501
        :rtype: V1Realtime
        """
        return self._realtime

    @realtime.setter
    def realtime(self, realtime):
        """Sets the realtime of this V1CPU.

        Realtime instructs the virt-launcher to tune the VMI for lower latency, optional for real time workloads  # noqa: E501

        :param realtime: The realtime of this V1CPU.  # noqa: E501
        :type: V1Realtime
        """

        self._realtime = realtime

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

        Sockets specifies the number of sockets inside the vmi. Must be a value greater or equal 1.  # noqa: E501

        :return: The sockets of this V1CPU.  # noqa: E501
        :rtype: int
        """
        return self._sockets

    @sockets.setter
    def sockets(self, sockets):
        """Sets the sockets of this V1CPU.

        Sockets specifies the number of sockets inside the vmi. Must be a value greater or equal 1.  # noqa: E501

        :param sockets: The sockets of this V1CPU.  # noqa: E501
        :type: int
        """

        self._sockets = sockets

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

        Threads specifies the number of threads inside the vmi. Must be a value greater or equal 1.  # noqa: E501

        :return: The threads of this V1CPU.  # noqa: E501
        :rtype: int
        """
        return self._threads

    @threads.setter
    def threads(self, threads):
        """Sets the threads of this V1CPU.

        Threads specifies the number of threads inside the vmi. Must be a value greater or equal 1.  # noqa: E501

        :param threads: The threads of this V1CPU.  # noqa: E501
        :type: int
        """

        self._threads = threads

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

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