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

"""
uexcorpapi

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


class Commodity(object):

    """Implementation of the 'Commodity' model.

    Attributes:
        is_accepted (str): The model property of type str.
        is_temporary_enabled (str): The model property of type str.
        price_variation (str): The model property of type str.
        scu_variation (str): The model property of type str.
        ttl (str): The model property of type str.
        additional_properties (Dict[str, Any]): The additional properties for
            the model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "is_accepted": 'is_accepted',
        "is_temporary_enabled": 'is_temporary_enabled',
        "price_variation": 'price_variation',
        "scu_variation": 'scu_variation',
        "ttl": 'ttl'
    }

    def __init__(self,
                 is_accepted=None,
                 is_temporary_enabled=None,
                 price_variation=None,
                 scu_variation=None,
                 ttl=None,
                 additional_properties=None):
        """Constructor for the Commodity class"""

        # Initialize members of the class
        self.is_accepted = is_accepted 
        self.is_temporary_enabled = is_temporary_enabled 
        self.price_variation = price_variation 
        self.scu_variation = scu_variation 
        self.ttl = ttl 

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @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
        is_accepted = dictionary.get("is_accepted") if dictionary.get("is_accepted") else None
        is_temporary_enabled = dictionary.get("is_temporary_enabled") if dictionary.get("is_temporary_enabled") else None
        price_variation = dictionary.get("price_variation") if dictionary.get("price_variation") else None
        scu_variation = dictionary.get("scu_variation") if dictionary.get("scu_variation") else None
        ttl = dictionary.get("ttl") if dictionary.get("ttl") else None
        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items() if k not in cls._names.values()},
            unboxing_function=lambda value: value)
        # Return an object of this model
        return cls(is_accepted,
                   is_temporary_enabled,
                   price_variation,
                   scu_variation,
                   ttl,
                   additional_properties)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'is_accepted={self.is_accepted!r}, '
                f'is_temporary_enabled={self.is_temporary_enabled!r}, '
                f'price_variation={self.price_variation!r}, '
                f'scu_variation={self.scu_variation!r}, '
                f'ttl={self.ttl!r}, '
                f'additional_properties={self.additional_properties!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'is_accepted={self.is_accepted!s}, '
                f'is_temporary_enabled={self.is_temporary_enabled!s}, '
                f'price_variation={self.price_variation!s}, '
                f'scu_variation={self.scu_variation!s}, '
                f'ttl={self.ttl!s}, '
                f'additional_properties={self.additional_properties!s})')
