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

"""
shelldatareportingapis

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from shelldatareportingapis.api_helper import APIHelper
from shelldatareportingapis.models.error_status import ErrorStatus
from shelldatareportingapis.models.fee_item_summary_all_of_0 import FeeItemSummaryAllOf0


class FeeSummaryResponse(object):

    """Implementation of the 'FeeSummaryResponse' model.

    TODO: type model description here.

    Attributes:
        fee_items_summary (List[FeeItemSummaryAllOf0]): TODO: type description
            here.
        request_id (str): A unique request id in GUID format. The value is
            written to the Shell API Platform audit log for end to end
            traceability of a request. If a value is not provided by an API
            client, then a GUID is automatically populated by the Shell API
            Platform and returned in the API response.
        error (ErrorStatus): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "fee_items_summary": 'FeeItemsSummary',
        "request_id": 'RequestId',
        "error": 'Error'
    }

    _optionals = [
        'fee_items_summary',
        'request_id',
        'error',
    ]

    def __init__(self,
                 fee_items_summary=APIHelper.SKIP,
                 request_id=APIHelper.SKIP,
                 error=APIHelper.SKIP):
        """Constructor for the FeeSummaryResponse class"""

        # Initialize members of the class
        if fee_items_summary is not APIHelper.SKIP:
            self.fee_items_summary = fee_items_summary 
        if request_id is not APIHelper.SKIP:
            self.request_id = request_id 
        if error is not APIHelper.SKIP:
            self.error = error 

    @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 not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        fee_items_summary = None
        if dictionary.get('FeeItemsSummary') is not None:
            fee_items_summary = [FeeItemSummaryAllOf0.from_dictionary(x) for x in dictionary.get('FeeItemsSummary')]
        else:
            fee_items_summary = APIHelper.SKIP
        request_id = dictionary.get("RequestId") if dictionary.get("RequestId") else APIHelper.SKIP
        error = ErrorStatus.from_dictionary(dictionary.get('Error')) if 'Error' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(fee_items_summary,
                   request_id,
                   error)
