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

"""
restapisdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from restapisdk.models.group_name_and_id_input import GroupNameAndIDInput


class ApiRestV2UserRemovegroupRequest(object):

    """Implementation of the 'Api Rest V2 User Removegroup Request' model.

    TODO: type model description here.

    Attributes:
        name (string): User name of the user account
        id (string): The GUID of the user account
        groups (list of GroupNameAndIDInput): A JSON array of group names or
            GUIDs or both. When both are given then id is considered

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": 'name',
        "id": 'id',
        "groups": 'groups'
    }

    def __init__(self,
                 name=None,
                 id=None,
                 groups=None):
        """Constructor for the ApiRestV2UserRemovegroupRequest class"""

        # Initialize members of the class
        self.name = name
        self.id = id
        self.groups = groups

    @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
        name = dictionary.get('name')
        id = dictionary.get('id')
        groups = None
        if dictionary.get('groups') is not None:
            groups = [GroupNameAndIDInput.from_dictionary(x) for x in dictionary.get('groups')]

        # Return an object of this model
        return cls(name,
                   id,
                   groups)
