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

"""
shelldatareportingapis

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


class CardUsageRestrictions(object):

    """Implementation of the 'CardUsageRestrictions' model.

    TODO: type model description here.

    Attributes:
        level (str): Describes at which level the restriction is set at. 
            Possible values:  OU = Restriction set at ColCo card type  
            Customer = Restriction set at customer card type
        daily_spend_limit (float): Maximum amount that can be spend on the
            card in a day.
        weekly_spend_limit (float): Maximum amount that can be spend on the
            card in a week.
        monthly_spend_limit (float): Maximum amount that can be spend on the
            card in a month.
        annual_spend_limit (float): Maximum amount that can be spend on the
            card in a year.
        life_time_spend_limit (float): Maximum amount that can be spend on the
            card in the card’s life time.
        daily_volume_limit (float): Maximum volume of fuel that can be bought
            on the card in a day.
        weekly_volume_limit (float): Maximum volume of fuel that can be bought
            on the card in a week.
        monthly_volume_limit (float): Maximum volume of fuel that can be
            bought on the card in a month.
        annual_volume_limit (float): Maximum volume of fuel that can be bought
            on the card in a year.
        life_time_volume_limit (float): Maximum volume of fuel that can be
            bought on the card in the card’s life time.
        transaction_spend_limit (float): Maximum amount that can be spend on
            the card in a transaction.
        transaction_volume_limit (float): Maximum volume of fuel that can be
            bought on the card in a transaction.
        daily_transaction_count (float): Maximum number of transactions
            allowed on a card in a day.
        weekly_transaction_count (float): Maximum number of transactions
            allowed on a card in a week.
        monthly_transaction_count (float): Maximum number of transactions
            allowed on a card in a month.
        annual_transaction_count (float): Maximum number of transactions
            allowed on the card in a year.
        life_time_transaction_count (float): Maximum number of transactions
            allowed on the card in the card’s life time.
        is_velocity_ceiling (bool): IsVelocityCeiling flag   Note: When
            "True", the velocity defaults configured in MS DB will be
            considered as the Max Limits for velocity changes. When ‘false’
            max allowed limits will be 999999999999 for Type “Count” and
            9999999999.99 for Type ‘Value’.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "level": 'Level',
        "daily_spend_limit": 'DailySpendLimit',
        "weekly_spend_limit": 'WeeklySpendLimit',
        "monthly_spend_limit": 'MonthlySpendLimit',
        "annual_spend_limit": 'AnnualSpendLimit',
        "life_time_spend_limit": 'LifeTimeSpendLimit',
        "daily_volume_limit": 'DailyVolumeLimit',
        "weekly_volume_limit": 'WeeklyVolumeLimit',
        "monthly_volume_limit": 'MonthlyVolumeLimit',
        "annual_volume_limit": 'AnnualVolumeLimit',
        "life_time_volume_limit": 'LifeTimeVolumeLimit',
        "transaction_spend_limit": 'TransactionSpendLimit',
        "transaction_volume_limit": 'TransactionVolumeLimit',
        "daily_transaction_count": 'DailyTransactionCount',
        "weekly_transaction_count": 'WeeklyTransactionCount',
        "monthly_transaction_count": 'MonthlyTransactionCount',
        "annual_transaction_count": 'AnnualTransactionCount',
        "life_time_transaction_count": 'LifeTimeTransactionCount',
        "is_velocity_ceiling": 'IsVelocityCeiling'
    }

    _optionals = [
        'level',
        'daily_spend_limit',
        'weekly_spend_limit',
        'monthly_spend_limit',
        'annual_spend_limit',
        'life_time_spend_limit',
        'daily_volume_limit',
        'weekly_volume_limit',
        'monthly_volume_limit',
        'annual_volume_limit',
        'life_time_volume_limit',
        'transaction_spend_limit',
        'transaction_volume_limit',
        'daily_transaction_count',
        'weekly_transaction_count',
        'monthly_transaction_count',
        'annual_transaction_count',
        'life_time_transaction_count',
        'is_velocity_ceiling',
    ]

    _nullables = [
        'level',
        'daily_spend_limit',
        'weekly_spend_limit',
        'monthly_spend_limit',
        'annual_spend_limit',
        'life_time_spend_limit',
        'daily_volume_limit',
        'weekly_volume_limit',
        'monthly_volume_limit',
        'annual_volume_limit',
        'life_time_volume_limit',
        'transaction_spend_limit',
        'transaction_volume_limit',
        'daily_transaction_count',
        'weekly_transaction_count',
        'monthly_transaction_count',
        'annual_transaction_count',
        'life_time_transaction_count',
    ]

    def __init__(self,
                 level=APIHelper.SKIP,
                 daily_spend_limit=APIHelper.SKIP,
                 weekly_spend_limit=APIHelper.SKIP,
                 monthly_spend_limit=APIHelper.SKIP,
                 annual_spend_limit=APIHelper.SKIP,
                 life_time_spend_limit=APIHelper.SKIP,
                 daily_volume_limit=APIHelper.SKIP,
                 weekly_volume_limit=APIHelper.SKIP,
                 monthly_volume_limit=APIHelper.SKIP,
                 annual_volume_limit=0,
                 life_time_volume_limit=APIHelper.SKIP,
                 transaction_spend_limit=APIHelper.SKIP,
                 transaction_volume_limit=APIHelper.SKIP,
                 daily_transaction_count=APIHelper.SKIP,
                 weekly_transaction_count=APIHelper.SKIP,
                 monthly_transaction_count=APIHelper.SKIP,
                 annual_transaction_count=APIHelper.SKIP,
                 life_time_transaction_count=APIHelper.SKIP,
                 is_velocity_ceiling=APIHelper.SKIP):
        """Constructor for the CardUsageRestrictions class"""

        # Initialize members of the class
        if level is not APIHelper.SKIP:
            self.level = level 
        if daily_spend_limit is not APIHelper.SKIP:
            self.daily_spend_limit = daily_spend_limit 
        if weekly_spend_limit is not APIHelper.SKIP:
            self.weekly_spend_limit = weekly_spend_limit 
        if monthly_spend_limit is not APIHelper.SKIP:
            self.monthly_spend_limit = monthly_spend_limit 
        if annual_spend_limit is not APIHelper.SKIP:
            self.annual_spend_limit = annual_spend_limit 
        if life_time_spend_limit is not APIHelper.SKIP:
            self.life_time_spend_limit = life_time_spend_limit 
        if daily_volume_limit is not APIHelper.SKIP:
            self.daily_volume_limit = daily_volume_limit 
        if weekly_volume_limit is not APIHelper.SKIP:
            self.weekly_volume_limit = weekly_volume_limit 
        if monthly_volume_limit is not APIHelper.SKIP:
            self.monthly_volume_limit = monthly_volume_limit 
        self.annual_volume_limit = annual_volume_limit 
        if life_time_volume_limit is not APIHelper.SKIP:
            self.life_time_volume_limit = life_time_volume_limit 
        if transaction_spend_limit is not APIHelper.SKIP:
            self.transaction_spend_limit = transaction_spend_limit 
        if transaction_volume_limit is not APIHelper.SKIP:
            self.transaction_volume_limit = transaction_volume_limit 
        if daily_transaction_count is not APIHelper.SKIP:
            self.daily_transaction_count = daily_transaction_count 
        if weekly_transaction_count is not APIHelper.SKIP:
            self.weekly_transaction_count = weekly_transaction_count 
        if monthly_transaction_count is not APIHelper.SKIP:
            self.monthly_transaction_count = monthly_transaction_count 
        if annual_transaction_count is not APIHelper.SKIP:
            self.annual_transaction_count = annual_transaction_count 
        if life_time_transaction_count is not APIHelper.SKIP:
            self.life_time_transaction_count = life_time_transaction_count 
        if is_velocity_ceiling is not APIHelper.SKIP:
            self.is_velocity_ceiling = is_velocity_ceiling 

    @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
        level = dictionary.get("Level") if "Level" in dictionary.keys() else APIHelper.SKIP
        daily_spend_limit = dictionary.get("DailySpendLimit") if "DailySpendLimit" in dictionary.keys() else APIHelper.SKIP
        weekly_spend_limit = dictionary.get("WeeklySpendLimit") if "WeeklySpendLimit" in dictionary.keys() else APIHelper.SKIP
        monthly_spend_limit = dictionary.get("MonthlySpendLimit") if "MonthlySpendLimit" in dictionary.keys() else APIHelper.SKIP
        annual_spend_limit = dictionary.get("AnnualSpendLimit") if "AnnualSpendLimit" in dictionary.keys() else APIHelper.SKIP
        life_time_spend_limit = dictionary.get("LifeTimeSpendLimit") if "LifeTimeSpendLimit" in dictionary.keys() else APIHelper.SKIP
        daily_volume_limit = dictionary.get("DailyVolumeLimit") if "DailyVolumeLimit" in dictionary.keys() else APIHelper.SKIP
        weekly_volume_limit = dictionary.get("WeeklyVolumeLimit") if "WeeklyVolumeLimit" in dictionary.keys() else APIHelper.SKIP
        monthly_volume_limit = dictionary.get("MonthlyVolumeLimit") if "MonthlyVolumeLimit" in dictionary.keys() else APIHelper.SKIP
        annual_volume_limit = dictionary.get("AnnualVolumeLimit") if dictionary.get("AnnualVolumeLimit") else 0
        life_time_volume_limit = dictionary.get("LifeTimeVolumeLimit") if "LifeTimeVolumeLimit" in dictionary.keys() else APIHelper.SKIP
        transaction_spend_limit = dictionary.get("TransactionSpendLimit") if "TransactionSpendLimit" in dictionary.keys() else APIHelper.SKIP
        transaction_volume_limit = dictionary.get("TransactionVolumeLimit") if "TransactionVolumeLimit" in dictionary.keys() else APIHelper.SKIP
        daily_transaction_count = dictionary.get("DailyTransactionCount") if "DailyTransactionCount" in dictionary.keys() else APIHelper.SKIP
        weekly_transaction_count = dictionary.get("WeeklyTransactionCount") if "WeeklyTransactionCount" in dictionary.keys() else APIHelper.SKIP
        monthly_transaction_count = dictionary.get("MonthlyTransactionCount") if "MonthlyTransactionCount" in dictionary.keys() else APIHelper.SKIP
        annual_transaction_count = dictionary.get("AnnualTransactionCount") if "AnnualTransactionCount" in dictionary.keys() else APIHelper.SKIP
        life_time_transaction_count = dictionary.get("LifeTimeTransactionCount") if "LifeTimeTransactionCount" in dictionary.keys() else APIHelper.SKIP
        is_velocity_ceiling = dictionary.get("IsVelocityCeiling") if "IsVelocityCeiling" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(level,
                   daily_spend_limit,
                   weekly_spend_limit,
                   monthly_spend_limit,
                   annual_spend_limit,
                   life_time_spend_limit,
                   daily_volume_limit,
                   weekly_volume_limit,
                   monthly_volume_limit,
                   annual_volume_limit,
                   life_time_volume_limit,
                   transaction_spend_limit,
                   transaction_volume_limit,
                   daily_transaction_count,
                   weekly_transaction_count,
                   monthly_transaction_count,
                   annual_transaction_count,
                   life_time_transaction_count,
                   is_velocity_ceiling)
