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

"""
shelldatareportingapis

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


class UsageSummary(object):

    """Implementation of the 'UsageSummary' model.

    TODO: type model description here.

    Attributes:
        date (str): Transaction date. The records will be sorted by this field
            in ascending order.   Format: yyyyMMdd
        product_id (int): Product Id
        product_code (str): Client Product code
        product_name (str): Product name in English
        is_fuel_product (bool): Whether the product is fuel or non-fuel
        site_group_id (int): Site Group Id
        site_group_name (str): Site Group Name
        total_volume (float): Total Volume
        total_gross (float): Total Gross in Customer Currency
        total_net (float): Total Net in Customer Currency
        currency_code (str): Customer Currency Code
        currency_symbol (str): Customer Currency Symbol
        product_group_id (int): Product group ID
        product_group_name (str): Product group Name

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "date": 'Date',
        "product_id": 'ProductId',
        "product_code": 'ProductCode',
        "product_name": 'ProductName',
        "is_fuel_product": 'IsFuelProduct',
        "site_group_id": 'SiteGroupId',
        "site_group_name": 'SiteGroupName',
        "total_volume": 'TotalVolume',
        "total_gross": 'TotalGross',
        "total_net": 'TotalNet',
        "currency_code": 'CurrencyCode',
        "currency_symbol": 'CurrencySymbol',
        "product_group_id": 'ProductGroupID',
        "product_group_name": 'ProductGroupName'
    }

    _optionals = [
        'date',
        'product_id',
        'product_code',
        'product_name',
        'is_fuel_product',
        'site_group_id',
        'site_group_name',
        'total_volume',
        'total_gross',
        'total_net',
        'currency_code',
        'currency_symbol',
        'product_group_id',
        'product_group_name',
    ]

    _nullables = [
        'date',
        'product_id',
        'product_code',
        'product_name',
        'is_fuel_product',
        'site_group_id',
        'site_group_name',
        'total_volume',
        'total_gross',
        'total_net',
        'currency_code',
        'currency_symbol',
        'product_group_id',
        'product_group_name',
    ]

    def __init__(self,
                 date=APIHelper.SKIP,
                 product_id=APIHelper.SKIP,
                 product_code=APIHelper.SKIP,
                 product_name=APIHelper.SKIP,
                 is_fuel_product=APIHelper.SKIP,
                 site_group_id=APIHelper.SKIP,
                 site_group_name=APIHelper.SKIP,
                 total_volume=APIHelper.SKIP,
                 total_gross=APIHelper.SKIP,
                 total_net=APIHelper.SKIP,
                 currency_code=APIHelper.SKIP,
                 currency_symbol=APIHelper.SKIP,
                 product_group_id=APIHelper.SKIP,
                 product_group_name=APIHelper.SKIP):
        """Constructor for the UsageSummary class"""

        # Initialize members of the class
        if date is not APIHelper.SKIP:
            self.date = date 
        if product_id is not APIHelper.SKIP:
            self.product_id = product_id 
        if product_code is not APIHelper.SKIP:
            self.product_code = product_code 
        if product_name is not APIHelper.SKIP:
            self.product_name = product_name 
        if is_fuel_product is not APIHelper.SKIP:
            self.is_fuel_product = is_fuel_product 
        if site_group_id is not APIHelper.SKIP:
            self.site_group_id = site_group_id 
        if site_group_name is not APIHelper.SKIP:
            self.site_group_name = site_group_name 
        if total_volume is not APIHelper.SKIP:
            self.total_volume = total_volume 
        if total_gross is not APIHelper.SKIP:
            self.total_gross = total_gross 
        if total_net is not APIHelper.SKIP:
            self.total_net = total_net 
        if currency_code is not APIHelper.SKIP:
            self.currency_code = currency_code 
        if currency_symbol is not APIHelper.SKIP:
            self.currency_symbol = currency_symbol 
        if product_group_id is not APIHelper.SKIP:
            self.product_group_id = product_group_id 
        if product_group_name is not APIHelper.SKIP:
            self.product_group_name = product_group_name 

    @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
        date = dictionary.get("Date") if "Date" in dictionary.keys() else APIHelper.SKIP
        product_id = dictionary.get("ProductId") if "ProductId" in dictionary.keys() else APIHelper.SKIP
        product_code = dictionary.get("ProductCode") if "ProductCode" in dictionary.keys() else APIHelper.SKIP
        product_name = dictionary.get("ProductName") if "ProductName" in dictionary.keys() else APIHelper.SKIP
        is_fuel_product = dictionary.get("IsFuelProduct") if "IsFuelProduct" in dictionary.keys() else APIHelper.SKIP
        site_group_id = dictionary.get("SiteGroupId") if "SiteGroupId" in dictionary.keys() else APIHelper.SKIP
        site_group_name = dictionary.get("SiteGroupName") if "SiteGroupName" in dictionary.keys() else APIHelper.SKIP
        total_volume = dictionary.get("TotalVolume") if "TotalVolume" in dictionary.keys() else APIHelper.SKIP
        total_gross = dictionary.get("TotalGross") if "TotalGross" in dictionary.keys() else APIHelper.SKIP
        total_net = dictionary.get("TotalNet") if "TotalNet" in dictionary.keys() else APIHelper.SKIP
        currency_code = dictionary.get("CurrencyCode") if "CurrencyCode" in dictionary.keys() else APIHelper.SKIP
        currency_symbol = dictionary.get("CurrencySymbol") if "CurrencySymbol" in dictionary.keys() else APIHelper.SKIP
        product_group_id = dictionary.get("ProductGroupID") if "ProductGroupID" in dictionary.keys() else APIHelper.SKIP
        product_group_name = dictionary.get("ProductGroupName") if "ProductGroupName" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(date,
                   product_id,
                   product_code,
                   product_name,
                   is_fuel_product,
                   site_group_id,
                   site_group_name,
                   total_volume,
                   total_gross,
                   total_net,
                   currency_code,
                   currency_symbol,
                   product_group_id,
                   product_group_name)
