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

"""
restapisdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from restapisdk.models.from_user_name_and_id_input import FromUserNameAndIDInput
from restapisdk.models.to_user_name_and_id_input import ToUserNameAndIDInput


class ApiRestV2AdminChangeownerRequest(object):

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

    TODO: type model description here.

    Attributes:
        meta_object_id (list of string): A JSON array of GUIDs of the metadata
            objects.    To change owner of all the objects owned by a user,
            provide single input as ALL.    If multiple object ids along with
            ALL is provided as input, then ALL will be considered.
        from_user (FromUserNameAndIDInput): A JSON object of name or GUIDs of
            the current owner of the objects. When both are given then id is
            considered.   If a list of object ids are provided as input for
            metaObjectId, then only for those ids that have owner as the value
            provided in fromUser, the owner will be changed.   Provide either
            name or id as input. When both are given user id will be
            considered.
        to_user (ToUserNameAndIDInput): A JSON object of name or GUIDs of the
            new owner for the objects. When both are given then id is
            considered.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "meta_object_id": 'metaObjectId',
        "from_user": 'fromUser',
        "to_user": 'toUser'
    }

    def __init__(self,
                 meta_object_id=None,
                 from_user=None,
                 to_user=None):
        """Constructor for the ApiRestV2AdminChangeownerRequest class"""

        # Initialize members of the class
        self.meta_object_id = meta_object_id
        self.from_user = from_user
        self.to_user = to_user

    @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
        meta_object_id = dictionary.get('metaObjectId')
        from_user = FromUserNameAndIDInput.from_dictionary(dictionary.get('fromUser')) if dictionary.get('fromUser') else None
        to_user = ToUserNameAndIDInput.from_dictionary(dictionary.get('toUser')) if dictionary.get('toUser') else None

        # Return an object of this model
        return cls(meta_object_id,
                   from_user,
                   to_user)
