# coding: utf-8


"""
IGNORE:
    Nutanix Security APIs

    Manage security features, such as encryption, certificates, or platform hardening.  # noqa: E501

    OpenAPI spec version: 4.0.1
    
    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_security_py_client.models.common.v1.config.KVPair import KVPair  # noqa: F401,E501
from ntnx_security_py_client.models.common.v1.response.ApiLink import ApiLink  # noqa: F401,E501
from ntnx_security_py_client.models.common.v1.response.ExternalizableAbstractModel import ExternalizableAbstractModel  # noqa: F401,E501
from ntnx_security_py_client.models.iam.v4.authn.BucketsAccessKey import BucketsAccessKey  # noqa: F401,E501
from ntnx_security_py_client.models.iam.v4.authn.CreationType import CreationType  # noqa: F401,E501
from ntnx_security_py_client.models.iam.v4.authn.UserStatusType import UserStatusType  # noqa: F401,E501
from ntnx_security_py_client.models.iam.v4.authn.UserType import UserType  # noqa: F401,E501

class User(ExternalizableAbstractModel):

    """Information of the user.

    :param username: (:attr:`username`) Identifier of the user.
    :type username: 
     min=1 chars, max=255 chars
    
    :param user_type: (:attr:`user_type`) 
    :type user_type: 
    
    
    :param idp_id: (:attr:`idp_id`) Identifier of the IDP for the user.
    :type idp_id: 
    
    
    :param display_name: (:attr:`display_name`) Display name of the user. For LDAP and SAML users, this is set from AD config.
    :type display_name: 
     min=1 chars, max=255 chars
    
    :param first_name: (:attr:`first_name`) First name of the user.
    :type first_name: 
     min=1 chars, max=255 chars
    
    :param middle_initial: (:attr:`middle_initial`) Middle name of the user.
    :type middle_initial: 
     min=1 chars, max=255 chars
    
    :param last_name: (:attr:`last_name`) Last name of the user.
    :type last_name: 
     min=1 chars, max=255 chars
    
    :param email_id: (:attr:`email_id`) Email ID of the user.
    :type email_id: 
     max=255 chars
    
    :param locale: (:attr:`locale`) Default locale of the user.
    :type locale: 
    
    
    :param region: (:attr:`region`) Default region of the user.
    :type region: 
    
    
    :param password: (:attr:`password`) Password of the user.
    :type password: 
    
    
    :param is_force_reset_password_enabled: (:attr:`is_force_reset_password_enabled`) Flag to force the user to reset password.
    :type is_force_reset_password_enabled: 
    
    
    :param additional_attributes: (:attr:`additional_attributes`) Indicates additional attributes of the user.
    :type additional_attributes: 
    
    
    :param status: (:attr:`status`) 
    :type status: 
    
    
    :param buckets_access_keys: (:attr:`buckets_access_keys`) Bucket access keys for the user.
    :type buckets_access_keys: 
    
    
    :param last_login_time: (:attr:`last_login_time`) The last successful login time for the user.
    :type last_login_time: 
    
    
    :param created_time: (:attr:`created_time`) Creation time of the user.
    :type created_time: 
    
    
    :param last_updated_time: (:attr:`last_updated_time`) The last updated time for the user.
    :type last_updated_time: 
    
    
    :param created_by: (:attr:`created_by`) User or Service who created the user.
    :type created_by: 
    
    
    :param last_updated_by: (:attr:`last_updated_by`) Last updated by this user ID.
    :type last_updated_by: 
    
    
    :param description: (:attr:`description`) Description of the user.
    :type description: 
    
    
    :param creation_type: (:attr:`creation_type`) 
    :type creation_type: 
    
    

    """
    """
    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 = {
        'username': 'str',
        'user_type': 'iam.v4.authn.UserType',
        'idp_id': 'str',
        'display_name': 'str',
        'first_name': 'str',
        'middle_initial': 'str',
        'last_name': 'str',
        'email_id': 'str',
        'locale': 'str',
        'region': 'str',
        'password': 'str',
        'is_force_reset_password_enabled': 'bool',
        'additional_attributes': 'list[common.v1.config.KVPair]',
        'status': 'iam.v4.authn.UserStatusType',
        'buckets_access_keys': 'list[iam.v4.authn.BucketsAccessKey]',
        'last_login_time': 'datetime',
        'created_time': 'datetime',
        'last_updated_time': 'datetime',
        'created_by': 'str',
        'last_updated_by': 'str',
        'description': 'str',
        'creation_type': 'iam.v4.authn.CreationType',
        '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 = {
        'username': 'username',
        'user_type': 'userType',
        'idp_id': 'idpId',
        'display_name': 'displayName',
        'first_name': 'firstName',
        'middle_initial': 'middleInitial',
        'last_name': 'lastName',
        'email_id': 'emailId',
        'locale': 'locale',
        'region': 'region',
        'password': 'password',
        'is_force_reset_password_enabled': 'isForceResetPasswordEnabled',
        'additional_attributes': 'additionalAttributes',
        'status': 'status',
        'buckets_access_keys': 'bucketsAccessKeys',
        'last_login_time': 'lastLoginTime',
        'created_time': 'createdTime',
        'last_updated_time': 'lastUpdatedTime',
        'created_by': 'createdBy',
        'last_updated_by': 'lastUpdatedBy',
        'description': 'description',
        'creation_type': 'creationType',
        'ext_id': 'extId',
        'links': 'links',
        'tenant_id': 'tenantId',
        '_reserved': '$reserved',
        '_object_type': '$objectType',
        '_unknown_fields': '$unknownFields',
    }



    def __init__(self, username=None, user_type=None, idp_id=None, display_name=None, first_name=None, middle_initial=None, last_name=None, email_id=None, locale=None, region=None, password=None, is_force_reset_password_enabled=None, additional_attributes=None, status=None, buckets_access_keys=None, last_login_time=None, created_time=None, last_updated_time=None, created_by=None, last_updated_by=None, description=None, creation_type=None, ext_id=None, links=None, tenant_id=None, *args, **kwargs):  # noqa: E501
        ExternalizableAbstractModel.__init__(self, ext_id, links, tenant_id, *args, **kwargs)
        self.__username = None
        self.__user_type = None
        self.__idp_id = None
        self.__display_name = None
        self.__first_name = None
        self.__middle_initial = None
        self.__last_name = None
        self.__email_id = None
        self.__locale = None
        self.__region = None
        self.__password = None
        self.__is_force_reset_password_enabled = None
        self.__additional_attributes = None
        self.__status = None
        self.__buckets_access_keys = None
        self.__last_login_time = None
        self.__created_time = None
        self.__last_updated_time = None
        self.__created_by = None
        self.__last_updated_by = None
        self.__description = None
        self.__creation_type = None
        self.discriminator = None
        if username is not None:
            self.__username = username
        if user_type is not None:
            self.__user_type = user_type
        if idp_id is not None:
            self.__idp_id = idp_id
        if display_name is not None:
            self.__display_name = display_name
        if first_name is not None:
            self.__first_name = first_name
        if middle_initial is not None:
            self.__middle_initial = middle_initial
        if last_name is not None:
            self.__last_name = last_name
        if email_id is not None:
            self.__email_id = email_id
        if locale is not None:
            self.__locale = locale
        if region is not None:
            self.__region = region
        if password is not None:
            self.__password = password
        if is_force_reset_password_enabled is not None:
            self.__is_force_reset_password_enabled = is_force_reset_password_enabled
        if additional_attributes is not None:
            self.__additional_attributes = additional_attributes
        if status is not None:
            self.__status = status
        if buckets_access_keys is not None:
            self.__buckets_access_keys = buckets_access_keys
        if last_login_time is not None:
            self.__last_login_time = last_login_time
        if created_time is not None:
            self.__created_time = created_time
        if last_updated_time is not None:
            self.__last_updated_time = last_updated_time
        if created_by is not None:
            self.__created_by = created_by
        if last_updated_by is not None:
            self.__last_updated_by = last_updated_by
        if description is not None:
            self.__description = description
        if creation_type is not None:
            self.__creation_type = creation_type

    def _initialize_object_type(self):
        return 'iam.v4.authn.User'

    def _initialize_object_version(self):
        return 'v4.r1.b1'


    @property
    def username(self):
        """
        Identifier of the user.

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

    @username.setter
    def username(self, username):
        if username is not None and len(username) > 255:
            raise ValueError("Invalid value for `username`, length must be less than or equal to `255`")  # noqa: E501
        if username is not None and len(username) < 1:
            raise ValueError("Invalid value for `username`, length must be greater than or equal to `1`")  # noqa: E501
        if username is not None and not re.search('^[^<>;\'()&+%\/\\\\\"`]*$', username):  # noqa: E501
            raise ValueError(r"Invalid value for `username`, must be a follow pattern or equal to `/^[^<>;'()&+%\/\\\\\"`]*$/`")  # noqa: E501

        self.__username = username

    @property
    def user_type(self):
        """
        

        :type:
            :class:`~ntnx_security_py_client.models.iam.v4.authn.UserType`
        """  # noqa: E501
        return self.__user_type

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

        self.__user_type = user_type

    @property
    def idp_id(self):
        """
        Identifier of the IDP for the user.

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

    @idp_id.setter
    def idp_id(self, idp_id):
        if idp_id is not None and not re.search('^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$', idp_id):  # noqa: E501
            raise ValueError(r"Invalid value for `idp_id`, must be a follow pattern or equal to `/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/`")  # noqa: E501

        self.__idp_id = idp_id

    @property
    def display_name(self):
        """
        Display name of the user. For LDAP and SAML users, this is set from AD config.

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

    @display_name.setter
    def display_name(self, display_name):
        if display_name is not None and len(display_name) > 255:
            raise ValueError("Invalid value for `display_name`, length must be less than or equal to `255`")  # noqa: E501
        if display_name is not None and len(display_name) < 1:
            raise ValueError("Invalid value for `display_name`, length must be greater than or equal to `1`")  # noqa: E501
        if display_name is not None and not re.search('^[^<>;\'()&+%\/\\\\\"`]*$', display_name):  # noqa: E501
            raise ValueError(r"Invalid value for `display_name`, must be a follow pattern or equal to `/^[^<>;'()&+%\/\\\\\"`]*$/`")  # noqa: E501

        self.__display_name = display_name

    @property
    def first_name(self):
        """
        First name of the user.

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

    @first_name.setter
    def first_name(self, first_name):
        if first_name is not None and len(first_name) > 255:
            raise ValueError("Invalid value for `first_name`, length must be less than or equal to `255`")  # noqa: E501
        if first_name is not None and len(first_name) < 1:
            raise ValueError("Invalid value for `first_name`, length must be greater than or equal to `1`")  # noqa: E501
        if first_name is not None and not re.search('^[^<>;\'()&+%\/\\\\\"`]*$', first_name):  # noqa: E501
            raise ValueError(r"Invalid value for `first_name`, must be a follow pattern or equal to `/^[^<>;'()&+%\/\\\\\"`]*$/`")  # noqa: E501

        self.__first_name = first_name

    @property
    def middle_initial(self):
        """
        Middle name of the user.

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

    @middle_initial.setter
    def middle_initial(self, middle_initial):
        if middle_initial is not None and len(middle_initial) > 255:
            raise ValueError("Invalid value for `middle_initial`, length must be less than or equal to `255`")  # noqa: E501
        if middle_initial is not None and len(middle_initial) < 1:
            raise ValueError("Invalid value for `middle_initial`, length must be greater than or equal to `1`")  # noqa: E501
        if middle_initial is not None and not re.search('^[^<>;\'()&+%\/\\\\\"`]*$', middle_initial):  # noqa: E501
            raise ValueError(r"Invalid value for `middle_initial`, must be a follow pattern or equal to `/^[^<>;'()&+%\/\\\\\"`]*$/`")  # noqa: E501

        self.__middle_initial = middle_initial

    @property
    def last_name(self):
        """
        Last name of the user.

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

    @last_name.setter
    def last_name(self, last_name):
        if last_name is not None and len(last_name) > 255:
            raise ValueError("Invalid value for `last_name`, length must be less than or equal to `255`")  # noqa: E501
        if last_name is not None and len(last_name) < 1:
            raise ValueError("Invalid value for `last_name`, length must be greater than or equal to `1`")  # noqa: E501
        if last_name is not None and not re.search('^[^<>;\'()&+%\/\\\\\"`]*$', last_name):  # noqa: E501
            raise ValueError(r"Invalid value for `last_name`, must be a follow pattern or equal to `/^[^<>;'()&+%\/\\\\\"`]*$/`")  # noqa: E501

        self.__last_name = last_name

    @property
    def email_id(self):
        """
        Email ID of the user.

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

    @email_id.setter
    def email_id(self, email_id):
        if email_id is not None and len(email_id) > 255:
            raise ValueError("Invalid value for `email_id`, length must be less than or equal to `255`")  # noqa: E501
        if email_id is not None and not re.search('^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$', email_id):  # noqa: E501
            raise ValueError(r"Invalid value for `email_id`, must be a follow pattern or equal to `/^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$/`")  # noqa: E501

        self.__email_id = email_id

    @property
    def locale(self):
        """
        Default locale of the user.

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

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

        self.__locale = locale

    @property
    def region(self):
        """
        Default region of the user.

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

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

        self.__region = region

    @property
    def password(self):
        """
        Password of the user.

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

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

        self.__password = password

    @property
    def is_force_reset_password_enabled(self):
        """
        Flag to force the user to reset password.

        :type:
                :class:`~bool`
        """  # noqa: E501
        return self.__is_force_reset_password_enabled

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

        self.__is_force_reset_password_enabled = is_force_reset_password_enabled

    @property
    def additional_attributes(self):
        """
        Indicates additional attributes of the user.

        :type:
             list[ :class:`~ntnx_security_py_client.models.common.v1.config.KVPair` ]
        """  # noqa: E501
        return self.__additional_attributes

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

        self.__additional_attributes = additional_attributes

    @property
    def status(self):
        """
        

        :type:
            :class:`~ntnx_security_py_client.models.iam.v4.authn.UserStatusType`
        """  # noqa: E501
        return self.__status

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

        self.__status = status

    @property
    def buckets_access_keys(self):
        """
        Bucket access keys for the user.

        :type:
             list[ :class:`~ntnx_security_py_client.models.iam.v4.authn.BucketsAccessKey` ]
        """  # noqa: E501
        return self.__buckets_access_keys

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

        self.__buckets_access_keys = buckets_access_keys

    @property
    def last_login_time(self):
        """
        The last successful login time for the user.

        :type:
                :class:`~datetime`
        """  # noqa: E501
        return self.__last_login_time

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

        self.__last_login_time = last_login_time

    @property
    def created_time(self):
        """
        Creation time of the user.

        :type:
                :class:`~datetime`
        """  # noqa: E501
        return self.__created_time

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

        self.__created_time = created_time

    @property
    def last_updated_time(self):
        """
        The last updated time for the user.

        :type:
                :class:`~datetime`
        """  # noqa: E501
        return self.__last_updated_time

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

        self.__last_updated_time = last_updated_time

    @property
    def created_by(self):
        """
        User or Service who created the user.

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

    @created_by.setter
    def created_by(self, created_by):
        if created_by is not None and not re.search('^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$', created_by):  # noqa: E501
            raise ValueError(r"Invalid value for `created_by`, must be a follow pattern or equal to `/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/`")  # noqa: E501

        self.__created_by = created_by

    @property
    def last_updated_by(self):
        """
        Last updated by this user ID.

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

    @last_updated_by.setter
    def last_updated_by(self, last_updated_by):
        if last_updated_by is not None and not re.search('^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$', last_updated_by):  # noqa: E501
            raise ValueError(r"Invalid value for `last_updated_by`, must be a follow pattern or equal to `/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/`")  # noqa: E501

        self.__last_updated_by = last_updated_by

    @property
    def description(self):
        """
        Description of the user.

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

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

        self.__description = description

    @property
    def creation_type(self):
        """
        

        :type:
            :class:`~ntnx_security_py_client.models.iam.v4.authn.CreationType`
        """  # noqa: E501
        return self.__creation_type

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

        self.__creation_type = creation_type

    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(User, dict):
            for key, value in six.iteritems(self):
                result[key] = value

        return result

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

        return self.__dict__ == other.__dict__

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

