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

"""
uexcorpapi

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


class Data(object):

    """Implementation of the 'Data' model.

    Attributes:
        buy (List[Buy]): The model property of type List[Buy].
        sell (List[Sell]): The model property of type List[Sell].
        additional_properties (Dict[str, Any]): The additional properties for
            the model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "buy": 'buy',
        "sell": 'sell'
    }

    def __init__(self,
                 buy=None,
                 sell=None,
                 additional_properties=None):
        """Constructor for the Data class"""

        # Initialize members of the class
        self.buy = buy 
        self.sell = sell 

        # 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
        buy = None
        if dictionary.get('buy') is not None:
            buy = [Buy.from_dictionary(x) for x in dictionary.get('buy')]
        sell = None
        if dictionary.get('sell') is not None:
            sell = [Sell.from_dictionary(x) for x in dictionary.get('sell')]
        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(buy,
                   sell,
                   additional_properties)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'buy={self.buy!r}, '
                f'sell={self.sell!r}, '
                f'additional_properties={self.additional_properties!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'buy={self.buy!s}, '
                f'sell={self.sell!s}, '
                f'additional_properties={self.additional_properties!s})')
