# coding: utf-8

"""
    Kubernetes

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

    The version of the OpenAPI document: release-1.36
    Generated by: https://openapi-generator.tech
"""


try:
    from inspect import getfullargspec
except ImportError:
    from inspect import getargspec as getfullargspec
import pprint
import re  # noqa: F401
import six

from kubernetes.client.configuration import Configuration


class V1alpha2PodGroupTemplate(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_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.
    """
    openapi_types = {
        'disruption_mode': 'str',
        'name': 'str',
        'priority': 'int',
        'priority_class_name': 'str',
        'resource_claims': 'list[V1alpha2PodGroupResourceClaim]',
        'scheduling_constraints': 'V1alpha2PodGroupSchedulingConstraints',
        'scheduling_policy': 'V1alpha2PodGroupSchedulingPolicy'
    }

    attribute_map = {
        'disruption_mode': 'disruptionMode',
        'name': 'name',
        'priority': 'priority',
        'priority_class_name': 'priorityClassName',
        'resource_claims': 'resourceClaims',
        'scheduling_constraints': 'schedulingConstraints',
        'scheduling_policy': 'schedulingPolicy'
    }

    def __init__(self, disruption_mode=None, name=None, priority=None, priority_class_name=None, resource_claims=None, scheduling_constraints=None, scheduling_policy=None, local_vars_configuration=None):  # noqa: E501
        """V1alpha2PodGroupTemplate - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration.get_default_copy()
        self.local_vars_configuration = local_vars_configuration

        self._disruption_mode = None
        self._name = None
        self._priority = None
        self._priority_class_name = None
        self._resource_claims = None
        self._scheduling_constraints = None
        self._scheduling_policy = None
        self.discriminator = None

        if disruption_mode is not None:
            self.disruption_mode = disruption_mode
        self.name = name
        if priority is not None:
            self.priority = priority
        if priority_class_name is not None:
            self.priority_class_name = priority_class_name
        if resource_claims is not None:
            self.resource_claims = resource_claims
        if scheduling_constraints is not None:
            self.scheduling_constraints = scheduling_constraints
        self.scheduling_policy = scheduling_policy

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

        DisruptionMode defines the mode in which a given PodGroup can be disrupted. One of Pod, PodGroup. This field is available only when the WorkloadAwarePreemption feature gate is enabled.  # noqa: E501

        :return: The disruption_mode of this V1alpha2PodGroupTemplate.  # noqa: E501
        :rtype: str
        """
        return self._disruption_mode

    @disruption_mode.setter
    def disruption_mode(self, disruption_mode):
        """Sets the disruption_mode of this V1alpha2PodGroupTemplate.

        DisruptionMode defines the mode in which a given PodGroup can be disrupted. One of Pod, PodGroup. This field is available only when the WorkloadAwarePreemption feature gate is enabled.  # noqa: E501

        :param disruption_mode: The disruption_mode of this V1alpha2PodGroupTemplate.  # noqa: E501
        :type disruption_mode: str
        """

        self._disruption_mode = disruption_mode

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

        Name is a unique identifier for the PodGroupTemplate within the Workload. It must be a DNS label. This field is immutable.  # noqa: E501

        :return: The name of this V1alpha2PodGroupTemplate.  # noqa: E501
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """Sets the name of this V1alpha2PodGroupTemplate.

        Name is a unique identifier for the PodGroupTemplate within the Workload. It must be a DNS label. This field is immutable.  # noqa: E501

        :param name: The name of this V1alpha2PodGroupTemplate.  # noqa: E501
        :type name: str
        """
        if self.local_vars_configuration.client_side_validation and name is None:  # noqa: E501
            raise ValueError("Invalid value for `name`, must not be `None`")  # noqa: E501

        self._name = name

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

        Priority is the value of priority of pod groups created from this template. Various system components use this field to find the priority of the pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is available only when the WorkloadAwarePreemption feature gate is enabled.  # noqa: E501

        :return: The priority of this V1alpha2PodGroupTemplate.  # noqa: E501
        :rtype: int
        """
        return self._priority

    @priority.setter
    def priority(self, priority):
        """Sets the priority of this V1alpha2PodGroupTemplate.

        Priority is the value of priority of pod groups created from this template. Various system components use this field to find the priority of the pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is available only when the WorkloadAwarePreemption feature gate is enabled.  # noqa: E501

        :param priority: The priority of this V1alpha2PodGroupTemplate.  # noqa: E501
        :type priority: int
        """

        self._priority = priority

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

        PriorityClassName indicates the priority that should be considered when scheduling a pod group created from this template. If no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, pod groups created from this template will have the priority set to zero. This field is available only when the WorkloadAwarePreemption feature gate is enabled.  # noqa: E501

        :return: The priority_class_name of this V1alpha2PodGroupTemplate.  # noqa: E501
        :rtype: str
        """
        return self._priority_class_name

    @priority_class_name.setter
    def priority_class_name(self, priority_class_name):
        """Sets the priority_class_name of this V1alpha2PodGroupTemplate.

        PriorityClassName indicates the priority that should be considered when scheduling a pod group created from this template. If no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, pod groups created from this template will have the priority set to zero. This field is available only when the WorkloadAwarePreemption feature gate is enabled.  # noqa: E501

        :param priority_class_name: The priority_class_name of this V1alpha2PodGroupTemplate.  # noqa: E501
        :type priority_class_name: str
        """

        self._priority_class_name = priority_class_name

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

        ResourceClaims defines which ResourceClaims may be shared among Pods in the group. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate.  This is an alpha-level field and requires that the DRAWorkloadResourceClaims feature gate is enabled.  This field is immutable.  # noqa: E501

        :return: The resource_claims of this V1alpha2PodGroupTemplate.  # noqa: E501
        :rtype: list[V1alpha2PodGroupResourceClaim]
        """
        return self._resource_claims

    @resource_claims.setter
    def resource_claims(self, resource_claims):
        """Sets the resource_claims of this V1alpha2PodGroupTemplate.

        ResourceClaims defines which ResourceClaims may be shared among Pods in the group. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate.  This is an alpha-level field and requires that the DRAWorkloadResourceClaims feature gate is enabled.  This field is immutable.  # noqa: E501

        :param resource_claims: The resource_claims of this V1alpha2PodGroupTemplate.  # noqa: E501
        :type resource_claims: list[V1alpha2PodGroupResourceClaim]
        """

        self._resource_claims = resource_claims

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


        :return: The scheduling_constraints of this V1alpha2PodGroupTemplate.  # noqa: E501
        :rtype: V1alpha2PodGroupSchedulingConstraints
        """
        return self._scheduling_constraints

    @scheduling_constraints.setter
    def scheduling_constraints(self, scheduling_constraints):
        """Sets the scheduling_constraints of this V1alpha2PodGroupTemplate.


        :param scheduling_constraints: The scheduling_constraints of this V1alpha2PodGroupTemplate.  # noqa: E501
        :type scheduling_constraints: V1alpha2PodGroupSchedulingConstraints
        """

        self._scheduling_constraints = scheduling_constraints

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


        :return: The scheduling_policy of this V1alpha2PodGroupTemplate.  # noqa: E501
        :rtype: V1alpha2PodGroupSchedulingPolicy
        """
        return self._scheduling_policy

    @scheduling_policy.setter
    def scheduling_policy(self, scheduling_policy):
        """Sets the scheduling_policy of this V1alpha2PodGroupTemplate.


        :param scheduling_policy: The scheduling_policy of this V1alpha2PodGroupTemplate.  # noqa: E501
        :type scheduling_policy: V1alpha2PodGroupSchedulingPolicy
        """
        if self.local_vars_configuration.client_side_validation and scheduling_policy is None:  # noqa: E501
            raise ValueError("Invalid value for `scheduling_policy`, must not be `None`")  # noqa: E501

        self._scheduling_policy = scheduling_policy

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

        def convert(x):
            if hasattr(x, "to_dict"):
                args = getfullargspec(x.to_dict).args
                if len(args) == 1:
                    return x.to_dict()
                else:
                    return x.to_dict(serialize)
            else:
                return x

        for attr, _ in six.iteritems(self.openapi_types):
            value = getattr(self, attr)
            attr = self.attribute_map.get(attr, attr) if serialize else attr
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: convert(x),
                    value
                ))
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], convert(item[1])),
                    value.items()
                ))
            else:
                result[attr] = convert(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, V1alpha2PodGroupTemplate):
            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, V1alpha2PodGroupTemplate):
            return True

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