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

"""
    apimaticcalculatorlatest

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


class Authorization(object):

    """Implementation of the 'Authorization' model.

    Authorization (Login) response

    Attributes:
        token (string): Generated token for authorization. It must be used in
            every request to API as param jwt. Token is valid for 1h
        message (string): Message
        is_error (bool): Is request success or not
        error_message (list of string): Error Message(s) in Array format
        code (string): Response code
        organization_id (int): Organization id - PMS ID
        supplier_id (int): Supplier ID (Property Manager ID - or PMS ID -
            depend on account on which you are logged in)
        party_id (int): Deprecated field. It will be removed in version 3.3.
            Please use supplierId field instead
        name (string): Account name
        currency (string): Account currency

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "token":'token',
        "message":'message',
        "is_error":'is_error',
        "error_message":'errorMessage',
        "organization_id":'organizationId',
        "supplier_id":'supplierId',
        "party_id":'partyId',
        "name":'name',
        "currency":'currency',
        "code":'code'
    }

    def __init__(self,
                 token=None,
                 message=None,
                 is_error=None,
                 error_message=None,
                 organization_id=None,
                 supplier_id=None,
                 party_id=None,
                 name=None,
                 currency=None,
                 code=None):
        """Constructor for the Authorization class"""

        # Initialize members of the class
        self.token = token
        self.message = message
        self.is_error = is_error
        self.error_message = error_message
        self.code = code
        self.organization_id = organization_id
        self.supplier_id = supplier_id
        self.party_id = party_id
        self.name = name
        self.currency = currency


    @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
        token = dictionary.get('token')
        message = dictionary.get('message')
        is_error = dictionary.get('is_error')
        error_message = dictionary.get('errorMessage')
        organization_id = dictionary.get('organizationId')
        supplier_id = dictionary.get('supplierId')
        party_id = dictionary.get('partyId')
        name = dictionary.get('name')
        currency = dictionary.get('currency')
        code = dictionary.get('code')

        # Return an object of this model
        return cls(token,
                   message,
                   is_error,
                   error_message,
                   organization_id,
                   supplier_id,
                   party_id,
                   name,
                   currency,
                   code)


