# -*- 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.tier import Tier


class PriceList(object):

    """Implementation of the 'PriceList' model.

    TODO: type model description here.

    Attributes:
        date (str): Date on which the price is applicable. Format: yyyyMMdd
            E.g.: 20180131
        day (str): Day on which the price is applicable. E.g.: Sunday, Monday
            etc.
        mtype (str): Price list type. E.g., List, Shell Standard International
            List
        price_list_id (int): Price list ID
        price_list_description (str): Price list description E.g., UK Fuels
            CRT Reseller List Price
        price_rule_id (int): Price Rule Id
        price_rule_name (str): Price Rule Name
        del_co_id (int): DelCo Id
        country_code (str): Country ISO Code E.g., UK, NL, etc.,
        country (str): Country E.g., United Kingdom, Netherlands etc
        product_group_id (int): Product Group Id
        product_group_name (str): Product Group name
        product_code (str): Client Product Code
        product_id (int): Product Id
        product_name (str): Product name in English
        price_per_unit (float): Price per unit
        currency_code (str): Currency Code. Format : 3 digit ISO code
        currency_symbol (str): Currency Symbol Example: £
        price_type (str): Price Type Possible Values are: •    Country– Price
            rule defined at country whereas Price Rule DelcoId same as
            ColcoId. •    TPNDelcoPrice – Price rule defined in the TPN
            whereas Price Rule DelcoId is different from ColcoId. •   
            NetworkPrice – Price rule defined at Fuel Network level. •   
            Other – Price rule defined at either Site or SiteGroup level.
        site_group_id (int): Site-Group ID E.g.: 100007
        site_group_name (str): Site-Group name
        site_code (int): Site Code
        site_id (int): Site ID
        site_name (str): Site Name
        fuel_network_id (int): Fuel Network ID
        network_name (str): Network Name
        price_rule_delco_id (int): PriceRuleDelcoId
        price_rule_delco_name (str): Company Name of the price rule DelCo.    
            E.g.:   •    Pilipinas Shell Petroleum Corp  •    Shell U.K. Oil
            Products Limited  •    G & V SERVICE STATIONS NV
        price_rule_country (str): PriceRuleCountry E.g.: United Kingdom
        price_rule_country_code (str): ISO Code of PriceRuleCountry E.g.: UK,
            NL, etc.,
        price_rule_basis_id (int): PriceRuleBasisId
        discount_value (float): Discount value
        price_per_unit_after_discount (float): Price per unit after discount
        vat_percentage (float): VAT Percentage
        price_rule_category_id (int): PriceRuleCategoryId
        tiers (List[Tier]): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "date": 'Date',
        "day": 'Day',
        "mtype": 'Type',
        "price_list_id": 'PriceListId',
        "price_list_description": 'PriceListDescription',
        "price_rule_id": 'PriceRuleId',
        "price_rule_name": 'PriceRuleName',
        "del_co_id": 'DelCoId',
        "country_code": 'CountryCode',
        "country": 'Country',
        "product_group_id": 'ProductGroupId',
        "product_group_name": 'ProductGroupName',
        "product_code": 'ProductCode',
        "product_id": 'ProductId',
        "product_name": 'ProductName',
        "price_per_unit": 'PricePerUnit',
        "currency_code": 'CurrencyCode',
        "currency_symbol": 'CurrencySymbol',
        "price_type": 'PriceType',
        "site_group_id": 'SiteGroupId',
        "site_group_name": 'SiteGroupName',
        "site_code": 'SiteCode',
        "site_id": 'SiteId',
        "site_name": 'SiteName',
        "fuel_network_id": 'FuelNetworkId',
        "network_name": 'NetworkName',
        "price_rule_delco_id": 'PriceRuleDelcoId',
        "price_rule_delco_name": 'PriceRuleDelcoName',
        "price_rule_country": 'PriceRuleCountry',
        "price_rule_country_code": 'PriceRuleCountryCode',
        "price_rule_basis_id": 'PriceRuleBasisId',
        "discount_value": 'DiscountValue',
        "price_per_unit_after_discount": 'PricePerUnitAfterDiscount',
        "vat_percentage": 'VATPercentage',
        "price_rule_category_id": 'PriceRuleCategoryId',
        "tiers": 'Tiers'
    }

    _optionals = [
        'date',
        'day',
        'mtype',
        'price_list_id',
        'price_list_description',
        'price_rule_id',
        'price_rule_name',
        'del_co_id',
        'country_code',
        'country',
        'product_group_id',
        'product_group_name',
        'product_code',
        'product_id',
        'product_name',
        'price_per_unit',
        'currency_code',
        'currency_symbol',
        'price_type',
        'site_group_id',
        'site_group_name',
        'site_code',
        'site_id',
        'site_name',
        'fuel_network_id',
        'network_name',
        'price_rule_delco_id',
        'price_rule_delco_name',
        'price_rule_country',
        'price_rule_country_code',
        'price_rule_basis_id',
        'discount_value',
        'price_per_unit_after_discount',
        'vat_percentage',
        'price_rule_category_id',
        'tiers',
    ]

    _nullables = [
        'date',
        'day',
        'mtype',
        'price_list_id',
        'price_list_description',
        'price_rule_id',
        'price_rule_name',
        'del_co_id',
        'country_code',
        'country',
        'product_group_id',
        'product_group_name',
        'product_code',
        'product_id',
        'product_name',
        'price_per_unit',
        'currency_code',
        'currency_symbol',
        'price_type',
        'site_group_id',
        'site_group_name',
        'site_code',
        'site_id',
        'site_name',
        'fuel_network_id',
        'network_name',
        'price_rule_delco_id',
        'price_rule_delco_name',
        'price_rule_country',
        'price_rule_country_code',
        'price_rule_basis_id',
        'discount_value',
        'price_per_unit_after_discount',
        'vat_percentage',
        'price_rule_category_id',
    ]

    def __init__(self,
                 date=APIHelper.SKIP,
                 day=APIHelper.SKIP,
                 mtype=APIHelper.SKIP,
                 price_list_id=APIHelper.SKIP,
                 price_list_description=APIHelper.SKIP,
                 price_rule_id=APIHelper.SKIP,
                 price_rule_name=APIHelper.SKIP,
                 del_co_id=APIHelper.SKIP,
                 country_code=APIHelper.SKIP,
                 country=APIHelper.SKIP,
                 product_group_id=APIHelper.SKIP,
                 product_group_name=APIHelper.SKIP,
                 product_code=APIHelper.SKIP,
                 product_id=APIHelper.SKIP,
                 product_name=APIHelper.SKIP,
                 price_per_unit=APIHelper.SKIP,
                 currency_code=APIHelper.SKIP,
                 currency_symbol=APIHelper.SKIP,
                 price_type=APIHelper.SKIP,
                 site_group_id=APIHelper.SKIP,
                 site_group_name=APIHelper.SKIP,
                 site_code=APIHelper.SKIP,
                 site_id=APIHelper.SKIP,
                 site_name=APIHelper.SKIP,
                 fuel_network_id=APIHelper.SKIP,
                 network_name=APIHelper.SKIP,
                 price_rule_delco_id=APIHelper.SKIP,
                 price_rule_delco_name=APIHelper.SKIP,
                 price_rule_country=APIHelper.SKIP,
                 price_rule_country_code=APIHelper.SKIP,
                 price_rule_basis_id=APIHelper.SKIP,
                 discount_value=APIHelper.SKIP,
                 price_per_unit_after_discount=APIHelper.SKIP,
                 vat_percentage=APIHelper.SKIP,
                 price_rule_category_id=APIHelper.SKIP,
                 tiers=APIHelper.SKIP):
        """Constructor for the PriceList class"""

        # Initialize members of the class
        if date is not APIHelper.SKIP:
            self.date = date 
        if day is not APIHelper.SKIP:
            self.day = day 
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype 
        if price_list_id is not APIHelper.SKIP:
            self.price_list_id = price_list_id 
        if price_list_description is not APIHelper.SKIP:
            self.price_list_description = price_list_description 
        if price_rule_id is not APIHelper.SKIP:
            self.price_rule_id = price_rule_id 
        if price_rule_name is not APIHelper.SKIP:
            self.price_rule_name = price_rule_name 
        if del_co_id is not APIHelper.SKIP:
            self.del_co_id = del_co_id 
        if country_code is not APIHelper.SKIP:
            self.country_code = country_code 
        if country is not APIHelper.SKIP:
            self.country = country 
        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 
        if product_code is not APIHelper.SKIP:
            self.product_code = product_code 
        if product_id is not APIHelper.SKIP:
            self.product_id = product_id 
        if product_name is not APIHelper.SKIP:
            self.product_name = product_name 
        if price_per_unit is not APIHelper.SKIP:
            self.price_per_unit = price_per_unit 
        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 price_type is not APIHelper.SKIP:
            self.price_type = price_type 
        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 site_code is not APIHelper.SKIP:
            self.site_code = site_code 
        if site_id is not APIHelper.SKIP:
            self.site_id = site_id 
        if site_name is not APIHelper.SKIP:
            self.site_name = site_name 
        if fuel_network_id is not APIHelper.SKIP:
            self.fuel_network_id = fuel_network_id 
        if network_name is not APIHelper.SKIP:
            self.network_name = network_name 
        if price_rule_delco_id is not APIHelper.SKIP:
            self.price_rule_delco_id = price_rule_delco_id 
        if price_rule_delco_name is not APIHelper.SKIP:
            self.price_rule_delco_name = price_rule_delco_name 
        if price_rule_country is not APIHelper.SKIP:
            self.price_rule_country = price_rule_country 
        if price_rule_country_code is not APIHelper.SKIP:
            self.price_rule_country_code = price_rule_country_code 
        if price_rule_basis_id is not APIHelper.SKIP:
            self.price_rule_basis_id = price_rule_basis_id 
        if discount_value is not APIHelper.SKIP:
            self.discount_value = discount_value 
        if price_per_unit_after_discount is not APIHelper.SKIP:
            self.price_per_unit_after_discount = price_per_unit_after_discount 
        if vat_percentage is not APIHelper.SKIP:
            self.vat_percentage = vat_percentage 
        if price_rule_category_id is not APIHelper.SKIP:
            self.price_rule_category_id = price_rule_category_id 
        if tiers is not APIHelper.SKIP:
            self.tiers = tiers 

    @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
        day = dictionary.get("Day") if "Day" in dictionary.keys() else APIHelper.SKIP
        mtype = dictionary.get("Type") if "Type" in dictionary.keys() else APIHelper.SKIP
        price_list_id = dictionary.get("PriceListId") if "PriceListId" in dictionary.keys() else APIHelper.SKIP
        price_list_description = dictionary.get("PriceListDescription") if "PriceListDescription" in dictionary.keys() else APIHelper.SKIP
        price_rule_id = dictionary.get("PriceRuleId") if "PriceRuleId" in dictionary.keys() else APIHelper.SKIP
        price_rule_name = dictionary.get("PriceRuleName") if "PriceRuleName" in dictionary.keys() else APIHelper.SKIP
        del_co_id = dictionary.get("DelCoId") if "DelCoId" in dictionary.keys() else APIHelper.SKIP
        country_code = dictionary.get("CountryCode") if "CountryCode" in dictionary.keys() else APIHelper.SKIP
        country = dictionary.get("Country") if "Country" 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
        product_code = dictionary.get("ProductCode") if "ProductCode" in dictionary.keys() else APIHelper.SKIP
        product_id = dictionary.get("ProductId") if "ProductId" in dictionary.keys() else APIHelper.SKIP
        product_name = dictionary.get("ProductName") if "ProductName" in dictionary.keys() else APIHelper.SKIP
        price_per_unit = dictionary.get("PricePerUnit") if "PricePerUnit" 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
        price_type = dictionary.get("PriceType") if "PriceType" 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
        site_code = dictionary.get("SiteCode") if "SiteCode" in dictionary.keys() else APIHelper.SKIP
        site_id = dictionary.get("SiteId") if "SiteId" in dictionary.keys() else APIHelper.SKIP
        site_name = dictionary.get("SiteName") if "SiteName" in dictionary.keys() else APIHelper.SKIP
        fuel_network_id = dictionary.get("FuelNetworkId") if "FuelNetworkId" in dictionary.keys() else APIHelper.SKIP
        network_name = dictionary.get("NetworkName") if "NetworkName" in dictionary.keys() else APIHelper.SKIP
        price_rule_delco_id = dictionary.get("PriceRuleDelcoId") if "PriceRuleDelcoId" in dictionary.keys() else APIHelper.SKIP
        price_rule_delco_name = dictionary.get("PriceRuleDelcoName") if "PriceRuleDelcoName" in dictionary.keys() else APIHelper.SKIP
        price_rule_country = dictionary.get("PriceRuleCountry") if "PriceRuleCountry" in dictionary.keys() else APIHelper.SKIP
        price_rule_country_code = dictionary.get("PriceRuleCountryCode") if "PriceRuleCountryCode" in dictionary.keys() else APIHelper.SKIP
        price_rule_basis_id = dictionary.get("PriceRuleBasisId") if "PriceRuleBasisId" in dictionary.keys() else APIHelper.SKIP
        discount_value = dictionary.get("DiscountValue") if "DiscountValue" in dictionary.keys() else APIHelper.SKIP
        price_per_unit_after_discount = dictionary.get("PricePerUnitAfterDiscount") if "PricePerUnitAfterDiscount" in dictionary.keys() else APIHelper.SKIP
        vat_percentage = dictionary.get("VATPercentage") if "VATPercentage" in dictionary.keys() else APIHelper.SKIP
        price_rule_category_id = dictionary.get("PriceRuleCategoryId") if "PriceRuleCategoryId" in dictionary.keys() else APIHelper.SKIP
        tiers = None
        if dictionary.get('Tiers') is not None:
            tiers = [Tier.from_dictionary(x) for x in dictionary.get('Tiers')]
        else:
            tiers = APIHelper.SKIP
        # Return an object of this model
        return cls(date,
                   day,
                   mtype,
                   price_list_id,
                   price_list_description,
                   price_rule_id,
                   price_rule_name,
                   del_co_id,
                   country_code,
                   country,
                   product_group_id,
                   product_group_name,
                   product_code,
                   product_id,
                   product_name,
                   price_per_unit,
                   currency_code,
                   currency_symbol,
                   price_type,
                   site_group_id,
                   site_group_name,
                   site_code,
                   site_id,
                   site_name,
                   fuel_network_id,
                   network_name,
                   price_rule_delco_id,
                   price_rule_delco_name,
                   price_rule_country,
                   price_rule_country_code,
                   price_rule_basis_id,
                   discount_value,
                   price_per_unit_after_discount,
                   vat_percentage,
                   price_rule_category_id,
                   tiers)
