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

"""
coingeckopublicapiv3

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


class ExchangeRates(object):

    """Implementation of the 'ExchangeRates' model.

    Attributes:
        rates (Dict[str, Rates]): The model property of type Dict[str, Rates].

    """

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

    _optionals = [
        'rates',
    ]

    def __init__(self,
                 rates=APIHelper.SKIP):
        """Constructor for the ExchangeRates class"""

        # Initialize members of the class
        if rates is not APIHelper.SKIP:
            self.rates = rates 

    @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
        rates = Rates.from_dictionary(dictionary.get('rates')) if 'rates' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(rates)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'rates={(self.rates if hasattr(self, "rates") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'rates={(self.rates if hasattr(self, "rates") else None)!s})')
