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

"""
shelldatareportingapis

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

from shelldatareportingapis.api_helper import APIHelper
import shelldatareportingapis.exceptions.api_exception
from shelldatareportingapis.models.error_details import ErrorDetails


class InvoiceManagementV1Download403ErrorException(shelldatareportingapis.exceptions.api_exception.APIException):
    def __init__(self, reason, response):
        """Constructor for the InvoiceManagementV1Download403ErrorException class

        Args:
            reason (string): The reason (or error message) for the Exception
                to be raised.
            response (HttpResponse): The HttpResponse of the API call.

        """
        super(InvoiceManagementV1Download403ErrorException, self).__init__(reason, response)
        dictionary = APIHelper.json_deserialize(self.response.text)
        if isinstance(dictionary, dict):
            self.unbox(dictionary)

    def unbox(self, dictionary):
        """Populates the properties of this object by extracting them 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.

        """
        self.request_id = dictionary.get("RequestId") if dictionary.get("RequestId") else None
        self.status = dictionary.get("Status") if dictionary.get("Status") else None
        self.errors = None
        if dictionary.get('Errors') is not None:
            self.errors = [ErrorDetails.from_dictionary(x) for x in dictionary.get('Errors')]
        else:
            self.errors = None
