# -*- coding: utf-8 -*-

"""
restapisdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""


class ApiRestV2AdminSyncprincipalRequest(object):

    """Implementation of the 'Api Rest V2 Admin Syncprincipal Request' model.

    TODO: type model description here.

    Attributes:
        principal_object (list of string): A JSON array of principal objects
            containing all users and groups present in the external system.   
            Example:    {    "name": "Customer Success",    "displayName":
            "Customer Success",    "description": "CS",    "created":
            1568926267025,    "modified": 1568926982242,   
            "principalTypeEnum": "LOCAL_GROUP",    "groupNames": [],   
            "visibility": "DEFAULT"    },    {    "name": "test",   
            "displayName": "test one",    "created": 1587573621279,   
            "modified": 1587573621674,    "mail": "test2@test.com",   
            "principalTypeEnum": "LOCAL_USER",    "groupNames": [
            "Administrator", "All" ],    "visibility": "DEFAULT"    }    You
            can leave the created and modified dates blank for new users.   
            You can specify if the principal is a user (LOCAL_USER) or user
            group (LOCAL_GROUP) in the principalTypeEnum keyword.    Set
            visibility to NON_SHARABLE, if you do not want the user to be able
            to share ThoughtSpot objects with other users in this group.
        update_modified (bool): Specifies whether to apply the changes to
            users and groups already in the cluster based on the principal
            object list input.
        delete_removed (bool): Specifies whether to delete the users and
            groups already in the cluster if not present in the principal
            object list input.
        new_user_password (string): Assign a password for new users added
            during the sync operation.    All new users added will have this
            password. It is mandatory to provide value for this field if new
            users are included in the input list.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "principal_object": 'principalObject',
        "update_modified": 'updateModified',
        "delete_removed": 'deleteRemoved',
        "new_user_password": 'newUserPassword'
    }

    def __init__(self,
                 principal_object=None,
                 update_modified=False,
                 delete_removed=False,
                 new_user_password=None):
        """Constructor for the ApiRestV2AdminSyncprincipalRequest class"""

        # Initialize members of the class
        self.principal_object = principal_object
        self.update_modified = update_modified
        self.delete_removed = delete_removed
        self.new_user_password = new_user_password

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if dictionary is None:
            return None

        # Extract variables from the dictionary
        principal_object = dictionary.get('principalObject')
        update_modified = dictionary.get("updateModified") if dictionary.get("updateModified") else False
        delete_removed = dictionary.get("deleteRemoved") if dictionary.get("deleteRemoved") else False
        new_user_password = dictionary.get('newUserPassword')

        # Return an object of this model
        return cls(principal_object,
                   update_modified,
                   delete_removed,
                   new_user_password)
