# coding: utf-8


"""
IGNORE:
    Nutanix Licensing APIs

    Manage licenses for your clusters and Prism Central, get information on applied licenses, license compliance details and feature entitlements.  # noqa: E501

    OpenAPI spec version: 4.3.2
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
IGNORE
"""
import pprint
import json
import ast
import re  # noqa: F401

import six
from pathlib import Path
from ntnx_licensing_py_client.models.common.v1.response.ApiLink import ApiLink  # noqa: F401,E501
from ntnx_licensing_py_client.models.common.v1.response.ExternalizableAbstractModel import ExternalizableAbstractModel  # noqa: F401,E501
from ntnx_licensing_py_client.models.licensing.v4.config.ClusterLicenseKeyMapping import ClusterLicenseKeyMapping  # noqa: F401,E501
from ntnx_licensing_py_client.models.licensing.v4.config.EnforcementPolicy import EnforcementPolicy  # noqa: F401,E501
from ntnx_licensing_py_client.models.licensing.v4.config.LicenseCategory import LicenseCategory  # noqa: F401,E501
from ntnx_licensing_py_client.models.licensing.v4.config.LicenseKeyAssociation import LicenseKeyAssociation  # noqa: F401,E501
from ntnx_licensing_py_client.models.licensing.v4.config.LicenseKeySubCategory import LicenseKeySubCategory  # noqa: F401,E501
from ntnx_licensing_py_client.models.licensing.v4.config.LicenseType import LicenseType  # noqa: F401,E501
from ntnx_licensing_py_client.models.licensing.v4.config.Meter import Meter  # noqa: F401,E501

class LicenseKey(ExternalizableAbstractModel):

    """Model for capturing license key detail attributes.

    :param key: (:attr:`key`) Attribute for capturing license key.
    :type key: 
     max=100 chars
    
    :param validation_detail: (:attr:`validation_detail`) Attribute for capturing validation data.
    :type validation_detail: 
     max=100 chars
    
    :param type: (:attr:`type`) 
    :type type: 
    
    
    :param category: (:attr:`category`) 
    :type category: 
    
    
    :param sub_category: (:attr:`sub_category`) 
    :type sub_category: 
    
    
    :param entitlement_expiry_date: (:attr:`entitlement_expiry_date`) Attribute for capturing expiry date of the entitlement encoded in license key.
    :type entitlement_expiry_date: 
    
    
    :param meter: (:attr:`meter`) 
    :type meter: 
    
    
    :param quantity: (:attr:`quantity`) Attribute for capturing license key quantity.
    :type quantity: 
    
    
    :param group_id: (:attr:`group_id`) Attribute for capturing groupId associated with this license key.
    :type group_id: 
     max=10 chars
    
    :param enforcement_policy: (:attr:`enforcement_policy`) 
    :type enforcement_policy: 
    
    
    :param assignment_details: (:attr:`assignment_details`) Expansion attribute used for fetching the license key assignment details.
    :type assignment_details: 
    
    
    :param association_details: (:attr:`association_details`) Expansion attribute capturing list of associated keys with details.
    :type association_details: 
    
    

    """
    """
    IGNORE:
    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.
    IGNORE
    """  # noqa: E501
    swagger_types = {
        'key': 'str',
        'validation_detail': 'str',
        'type': 'licensing.v4.config.LicenseType',
        'category': 'licensing.v4.config.LicenseCategory',
        'sub_category': 'licensing.v4.config.LicenseKeySubCategory',
        'entitlement_expiry_date': 'date',
        'meter': 'licensing.v4.config.Meter',
        'quantity': 'float',
        'group_id': 'str',
        'enforcement_policy': 'licensing.v4.config.EnforcementPolicy',
        'assignment_details': 'list[licensing.v4.config.ClusterLicenseKeyMapping]',
        'association_details': 'list[licensing.v4.config.LicenseKeyAssociation]',
        'ext_id': 'str',
        'links': 'list[common.v1.response.ApiLink]',
        'tenant_id': 'str',
        '_reserved': 'dict(str, object)',
        '_object_type': 'str',
        '_unknown_fields': 'dict(str, object)',
    }

    attribute_map = {
        'key': 'key',
        'validation_detail': 'validationDetail',
        'type': 'type',
        'category': 'category',
        'sub_category': 'subCategory',
        'entitlement_expiry_date': 'entitlementExpiryDate',
        'meter': 'meter',
        'quantity': 'quantity',
        'group_id': 'groupId',
        'enforcement_policy': 'enforcementPolicy',
        'assignment_details': 'assignmentDetails',
        'association_details': 'associationDetails',
        'ext_id': 'extId',
        'links': 'links',
        'tenant_id': 'tenantId',
        '_reserved': '$reserved',
        '_object_type': '$objectType',
        '_unknown_fields': '$unknownFields',
    }



    def __init__(self, key=None, validation_detail=None, type=None, category=None, sub_category=None, entitlement_expiry_date=None, meter=None, quantity=None, group_id=None, enforcement_policy=None, assignment_details=None, association_details=None, ext_id=None, links=None, tenant_id=None, *args, **kwargs):  # noqa: E501
        ExternalizableAbstractModel.__init__(self, ext_id, links, tenant_id, *args, **kwargs)
        self.__key = None
        self.__validation_detail = None
        self.__type = None
        self.__category = None
        self.__sub_category = None
        self.__entitlement_expiry_date = None
        self.__meter = None
        self.__quantity = None
        self.__group_id = None
        self.__enforcement_policy = None
        self.__assignment_details = None
        self.__association_details = None
        self.discriminator = None
        if key is not None:
            self.__key = key
        if validation_detail is not None:
            self.__validation_detail = validation_detail
        if type is not None:
            self.__type = type
        if category is not None:
            self.__category = category
        if sub_category is not None:
            self.__sub_category = sub_category
        if entitlement_expiry_date is not None:
            self.__entitlement_expiry_date = entitlement_expiry_date
        if meter is not None:
            self.__meter = meter
        if quantity is not None:
            self.__quantity = quantity
        if group_id is not None:
            self.__group_id = group_id
        if enforcement_policy is not None:
            self.__enforcement_policy = enforcement_policy
        if assignment_details is not None:
            self.__assignment_details = assignment_details
        if association_details is not None:
            self.__association_details = association_details

    def _initialize_object_type(self):
        return 'licensing.v4.config.LicenseKey'

    def _initialize_object_version(self):
        return 'v4.r3'


    @property
    def key(self):
        """
        Attribute for capturing license key.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__key

    @key.setter
    def key(self, key):
        if key is not None and len(key) > 100:
            raise ValueError("Invalid value for `key`, length must be less than or equal to `100`")  # noqa: E501

        self.__key = key

    @property
    def validation_detail(self):
        """
        Attribute for capturing validation data.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__validation_detail

    @validation_detail.setter
    def validation_detail(self, validation_detail):
        if validation_detail is not None and len(validation_detail) > 100:
            raise ValueError("Invalid value for `validation_detail`, length must be less than or equal to `100`")  # noqa: E501

        self.__validation_detail = validation_detail

    @property
    def type(self):
        """
        

        :type:
            :class:`~ntnx_licensing_py_client.models.licensing.v4.config.LicenseType`
        """  # noqa: E501
        return self.__type

    @type.setter
    def type(self, type):

        self.__type = type

    @property
    def category(self):
        """
        

        :type:
            :class:`~ntnx_licensing_py_client.models.licensing.v4.config.LicenseCategory`
        """  # noqa: E501
        return self.__category

    @category.setter
    def category(self, category):

        self.__category = category

    @property
    def sub_category(self):
        """
        

        :type:
            :class:`~ntnx_licensing_py_client.models.licensing.v4.config.LicenseKeySubCategory`
        """  # noqa: E501
        return self.__sub_category

    @sub_category.setter
    def sub_category(self, sub_category):

        self.__sub_category = sub_category

    @property
    def entitlement_expiry_date(self):
        """
        Attribute for capturing expiry date of the entitlement encoded in license key.

        :type:
                :class:`~date`
        """  # noqa: E501
        return self.__entitlement_expiry_date

    @entitlement_expiry_date.setter
    def entitlement_expiry_date(self, entitlement_expiry_date):

        self.__entitlement_expiry_date = entitlement_expiry_date

    @property
    def meter(self):
        """
        

        :type:
            :class:`~ntnx_licensing_py_client.models.licensing.v4.config.Meter`
        """  # noqa: E501
        return self.__meter

    @meter.setter
    def meter(self, meter):

        self.__meter = meter

    @property
    def quantity(self):
        """
        Attribute for capturing license key quantity.

        :type:
                :class:`~float`
        """  # noqa: E501
        return self.__quantity

    @quantity.setter
    def quantity(self, quantity):

        self.__quantity = quantity

    @property
    def group_id(self):
        """
        Attribute for capturing groupId associated with this license key.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__group_id

    @group_id.setter
    def group_id(self, group_id):
        if group_id is not None and len(group_id) > 10:
            raise ValueError("Invalid value for `group_id`, length must be less than or equal to `10`")  # noqa: E501

        self.__group_id = group_id

    @property
    def enforcement_policy(self):
        """
        

        :type:
            :class:`~ntnx_licensing_py_client.models.licensing.v4.config.EnforcementPolicy`
        """  # noqa: E501
        return self.__enforcement_policy

    @enforcement_policy.setter
    def enforcement_policy(self, enforcement_policy):

        self.__enforcement_policy = enforcement_policy

    @property
    def assignment_details(self):
        """
        Expansion attribute used for fetching the license key assignment details.

        :type:
             list[ :class:`~ntnx_licensing_py_client.models.licensing.v4.config.ClusterLicenseKeyMapping` ]
        """  # noqa: E501
        return self.__assignment_details

    @assignment_details.setter
    def assignment_details(self, assignment_details):

        self.__assignment_details = assignment_details

    @property
    def association_details(self):
        """
        Expansion attribute capturing list of associated keys with details.

        :type:
             list[ :class:`~ntnx_licensing_py_client.models.licensing.v4.config.LicenseKeyAssociation` ]
        """  # noqa: E501
        return self.__association_details

    @association_details.setter
    def association_details(self, association_details):

        self.__association_details = association_details

    def _to_dict(self, sanitize):
        """Returns the model properties as a dict. Omits None properties based on the provided "sanitize" parameter.

        :param sanitize: A flag to omit None properties if set to True
        :type sanitize: bool
        """

        result = {}
        for attr, attr_type in six.iteritems(self.swagger_types):

            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x._to_dict(sanitize) if hasattr(x, "_to_dict") else x,
                    value
                ))
            elif hasattr(value, "_to_dict"):
                result[attr] = value._to_dict(sanitize)
            elif isinstance(value, Path):
                result[attr] = str(value)
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1]._to_dict(sanitize)) if hasattr(item[1], "_to_dict")
                    else (
                        (item[0], str(item[1])) if item[0] == 'path' and '$objectType' in value and value['$objectType'] == 'pathlib.Path'
                        else item
                    ),
                    six.iteritems(value)
                ))
            else:
                if sanitize:
                    if value is not None:
                        result[attr] = value
                else:
                    result[attr] = value
        if issubclass(LicenseKey, dict):
            for key, value in six.iteritems(self):
                result[key] = value

        # handle unknown fields
        result['_unknown_fields'] = {}
        unknown = self.get_unknown_fields()
        if sanitize:
            unknown = self._sanitize_for_serialization(unknown)

        return {**result, **unknown}


    def to_dict(self):
        """Returns the model properties as a dictionary"""
        return self._to_dict(False)

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

    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, LicenseKey):
            return False

        return self.__dict__ == other.__dict__

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

