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

"""
uexcorpapi

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


class Data6(object):

    """Implementation of the 'Data6' model.

    Attributes:
        commodity_name (str): The model property of type str.
        date_added (str): The model property of type str.
        date_modified (str): The model property of type str.
        id (str): The model property of type str.
        id_commodity (str): The model property of type str.
        id_terminal (str): The model property of type str.
        price_buy (str): The model property of type str.
        price_buy_avg (str): The model property of type str.
        terminal_name (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 = {
        "commodity_name": 'commodity_name',
        "date_added": 'date_added',
        "date_modified": 'date_modified',
        "id": 'id',
        "id_commodity": 'id_commodity',
        "id_terminal": 'id_terminal',
        "price_buy": 'price_buy',
        "price_buy_avg": 'price_buy_avg',
        "terminal_name": 'terminal_name'
    }

    def __init__(self,
                 commodity_name=None,
                 date_added=None,
                 date_modified=None,
                 id=None,
                 id_commodity=None,
                 id_terminal=None,
                 price_buy=None,
                 price_buy_avg=None,
                 terminal_name=None,
                 additional_properties=None):
        """Constructor for the Data6 class"""

        # Initialize members of the class
        self.commodity_name = commodity_name 
        self.date_added = date_added 
        self.date_modified = date_modified 
        self.id = id 
        self.id_commodity = id_commodity 
        self.id_terminal = id_terminal 
        self.price_buy = price_buy 
        self.price_buy_avg = price_buy_avg 
        self.terminal_name = terminal_name 

        # 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
        commodity_name = dictionary.get("commodity_name") if dictionary.get("commodity_name") else None
        date_added = dictionary.get("date_added") if dictionary.get("date_added") else None
        date_modified = dictionary.get("date_modified") if dictionary.get("date_modified") else None
        id = dictionary.get("id") if dictionary.get("id") else None
        id_commodity = dictionary.get("id_commodity") if dictionary.get("id_commodity") else None
        id_terminal = dictionary.get("id_terminal") if dictionary.get("id_terminal") else None
        price_buy = dictionary.get("price_buy") if dictionary.get("price_buy") else None
        price_buy_avg = dictionary.get("price_buy_avg") if dictionary.get("price_buy_avg") else None
        terminal_name = dictionary.get("terminal_name") if dictionary.get("terminal_name") 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(commodity_name,
                   date_added,
                   date_modified,
                   id,
                   id_commodity,
                   id_terminal,
                   price_buy,
                   price_buy_avg,
                   terminal_name,
                   additional_properties)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'commodity_name={self.commodity_name!r}, '
                f'date_added={self.date_added!r}, '
                f'date_modified={self.date_modified!r}, '
                f'id={self.id!r}, '
                f'id_commodity={self.id_commodity!r}, '
                f'id_terminal={self.id_terminal!r}, '
                f'price_buy={self.price_buy!r}, '
                f'price_buy_avg={self.price_buy_avg!r}, '
                f'terminal_name={self.terminal_name!r}, '
                f'additional_properties={self.additional_properties!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'commodity_name={self.commodity_name!s}, '
                f'date_added={self.date_added!s}, '
                f'date_modified={self.date_modified!s}, '
                f'id={self.id!s}, '
                f'id_commodity={self.id_commodity!s}, '
                f'id_terminal={self.id_terminal!s}, '
                f'price_buy={self.price_buy!s}, '
                f'price_buy_avg={self.price_buy_avg!s}, '
                f'terminal_name={self.terminal_name!s}, '
                f'additional_properties={self.additional_properties!s})')
