# -*- 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.bonus_configuration import BonusConfiguration
from shelldatareportingapis.models.error_status import ErrorStatus
from shelldatareportingapis.models.pricing_current_volume import PricingCurrentVolume
from shelldatareportingapis.models.pricing_history import PricingHistory


class VolumeBasedPricingResponse(object):

    """Implementation of the 'VolumeBasedPricingResponse' model.

    TODO: type model description here.

    Attributes:
        configuration (List[BonusConfiguration]): TODO: type description here.
        current_period_consumption (List[PricingCurrentVolume]): TODO: type
            description here.
        history (List[PricingHistory]): TODO: type description here.
        error (ErrorStatus): TODO: type description here.
        request_id (str): API Request Id

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "configuration": 'Configuration',
        "current_period_consumption": 'CurrentPeriodConsumption',
        "history": 'History',
        "error": 'Error',
        "request_id": 'RequestId'
    }

    _optionals = [
        'configuration',
        'current_period_consumption',
        'history',
        'error',
        'request_id',
    ]

    def __init__(self,
                 configuration=APIHelper.SKIP,
                 current_period_consumption=APIHelper.SKIP,
                 history=APIHelper.SKIP,
                 error=APIHelper.SKIP,
                 request_id=APIHelper.SKIP):
        """Constructor for the VolumeBasedPricingResponse class"""

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

    @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
        configuration = None
        if dictionary.get('Configuration') is not None:
            configuration = [BonusConfiguration.from_dictionary(x) for x in dictionary.get('Configuration')]
        else:
            configuration = APIHelper.SKIP
        current_period_consumption = None
        if dictionary.get('CurrentPeriodConsumption') is not None:
            current_period_consumption = [PricingCurrentVolume.from_dictionary(x) for x in dictionary.get('CurrentPeriodConsumption')]
        else:
            current_period_consumption = APIHelper.SKIP
        history = None
        if dictionary.get('History') is not None:
            history = [PricingHistory.from_dictionary(x) for x in dictionary.get('History')]
        else:
            history = APIHelper.SKIP
        error = ErrorStatus.from_dictionary(dictionary.get('Error')) if 'Error' in dictionary.keys() else APIHelper.SKIP
        request_id = dictionary.get("RequestId") if dictionary.get("RequestId") else APIHelper.SKIP
        # Return an object of this model
        return cls(configuration,
                   current_period_consumption,
                   history,
                   error,
                   request_id)
