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

"""
zypev1

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


class OAuthRequest(object):

    """Implementation of the 'OAuthRequest' model.

    TODO: type model description here.

    Attributes:
        client_id (string): The client ID for your Zype application
        client_secret (string): The client secret for your Zype application
        username (string): The username (email) of the consumer
        password (string): Password of the consumer. Password is required if
            username is used to authenticate.
        linked_device_id (string): The linked device ID of the consumer.
            Required if using username to authenticate.
        pin (string): The pin for the linked device. Pin is required if linked
            device ID is used to authenticate.
        grant_type (string): Use ‘password’. Required if using linked device
            ID to authenticate.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client_id": 'client_id',
        "client_secret": 'client_secret',
        "username": 'username',
        "password": 'password',
        "linked_device_id": 'linked_device_id',
        "pin": 'pin',
        "grant_type": 'grant_type'
    }

    def __init__(self,
                 client_id=None,
                 client_secret=None,
                 username=None,
                 password=None,
                 linked_device_id=None,
                 pin=None,
                 grant_type=None):
        """Constructor for the OAuthRequest class"""

        # Initialize members of the class
        self.client_id = client_id
        self.client_secret = client_secret
        self.username = username
        self.password = password
        self.linked_device_id = linked_device_id
        self.pin = pin
        self.grant_type = grant_type

    @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
        client_id = dictionary.get('client_id')
        client_secret = dictionary.get('client_secret')
        username = dictionary.get('username')
        password = dictionary.get('password')
        linked_device_id = dictionary.get('linked_device_id')
        pin = dictionary.get('pin')
        grant_type = dictionary.get('grant_type')

        # Return an object of this model
        return cls(client_id,
                   client_secret,
                   username,
                   password,
                   linked_device_id,
                   pin,
                   grant_type)
