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

"""
shelldatareportingapis

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


class Tier(object):

    """Implementation of the 'Tier' model.

    TODO: type model description here.

    Attributes:
        tier_price_list_id (int): The price list if reference price is list
            price. Only used when the Price Rule category is set to. ‘Tiered
            Pricing’.
        price_list_description (str): Price list description of the tier.
        tier_min (int): Minimum tier volume E.g., 500
        tier_max (int): Maximum tier volume E.g., 1000
        tiered_pricing_group_name (str): Pricing group name of tier
        tiered_pricing_group_period (str): Tiered pricing group period.
            Possible Values 1.    Monthly 2.    Quarterly 3.    Semi Annually
            4.    Annual
        discount_value (float): Discount value to be applied to the List price
            or pump price.
        price_per_unit (float): Price per unit after discount   Note: This
            field will not contain any value for discounts on retail prices.
        price_per_unit_after_discount (float): Price per unit (List Price)  
            Note: This field will not contain any value for discounts on
            retail prices.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "tier_price_list_id": 'TierPriceListId',
        "price_list_description": 'PriceListDescription',
        "tier_min": 'TierMin',
        "tier_max": 'TierMax',
        "tiered_pricing_group_name": 'TieredPricingGroupName',
        "tiered_pricing_group_period": 'TieredPricingGroupPeriod',
        "discount_value": 'DiscountValue',
        "price_per_unit": 'PricePerUnit',
        "price_per_unit_after_discount": 'PricePerUnitAfterDiscount'
    }

    _optionals = [
        'tier_price_list_id',
        'price_list_description',
        'tier_min',
        'tier_max',
        'tiered_pricing_group_name',
        'tiered_pricing_group_period',
        'discount_value',
        'price_per_unit',
        'price_per_unit_after_discount',
    ]

    _nullables = [
        'tier_price_list_id',
        'price_list_description',
        'tier_min',
        'tier_max',
        'tiered_pricing_group_name',
        'tiered_pricing_group_period',
        'discount_value',
        'price_per_unit',
        'price_per_unit_after_discount',
    ]

    def __init__(self,
                 tier_price_list_id=APIHelper.SKIP,
                 price_list_description=APIHelper.SKIP,
                 tier_min=APIHelper.SKIP,
                 tier_max=APIHelper.SKIP,
                 tiered_pricing_group_name=APIHelper.SKIP,
                 tiered_pricing_group_period=APIHelper.SKIP,
                 discount_value=APIHelper.SKIP,
                 price_per_unit=APIHelper.SKIP,
                 price_per_unit_after_discount=APIHelper.SKIP):
        """Constructor for the Tier class"""

        # Initialize members of the class
        if tier_price_list_id is not APIHelper.SKIP:
            self.tier_price_list_id = tier_price_list_id 
        if price_list_description is not APIHelper.SKIP:
            self.price_list_description = price_list_description 
        if tier_min is not APIHelper.SKIP:
            self.tier_min = tier_min 
        if tier_max is not APIHelper.SKIP:
            self.tier_max = tier_max 
        if tiered_pricing_group_name is not APIHelper.SKIP:
            self.tiered_pricing_group_name = tiered_pricing_group_name 
        if tiered_pricing_group_period is not APIHelper.SKIP:
            self.tiered_pricing_group_period = tiered_pricing_group_period 
        if discount_value is not APIHelper.SKIP:
            self.discount_value = discount_value 
        if price_per_unit is not APIHelper.SKIP:
            self.price_per_unit = price_per_unit 
        if price_per_unit_after_discount is not APIHelper.SKIP:
            self.price_per_unit_after_discount = price_per_unit_after_discount 

    @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
        tier_price_list_id = dictionary.get("TierPriceListId") if "TierPriceListId" in dictionary.keys() else APIHelper.SKIP
        price_list_description = dictionary.get("PriceListDescription") if "PriceListDescription" in dictionary.keys() else APIHelper.SKIP
        tier_min = dictionary.get("TierMin") if "TierMin" in dictionary.keys() else APIHelper.SKIP
        tier_max = dictionary.get("TierMax") if "TierMax" in dictionary.keys() else APIHelper.SKIP
        tiered_pricing_group_name = dictionary.get("TieredPricingGroupName") if "TieredPricingGroupName" in dictionary.keys() else APIHelper.SKIP
        tiered_pricing_group_period = dictionary.get("TieredPricingGroupPeriod") if "TieredPricingGroupPeriod" in dictionary.keys() else APIHelper.SKIP
        discount_value = dictionary.get("DiscountValue") if "DiscountValue" in dictionary.keys() else APIHelper.SKIP
        price_per_unit = dictionary.get("PricePerUnit") if "PricePerUnit" in dictionary.keys() else APIHelper.SKIP
        price_per_unit_after_discount = dictionary.get("PricePerUnitAfterDiscount") if "PricePerUnitAfterDiscount" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(tier_price_list_id,
                   price_list_description,
                   tier_min,
                   tier_max,
                   tiered_pricing_group_name,
                   tiered_pricing_group_period,
                   discount_value,
                   price_per_unit,
                   price_per_unit_after_discount)
