# -*- 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.current_price_1 import CurrentPrice1
from coingeckopublicapiv3.models.market_cap_1 import MarketCap1
from coingeckopublicapiv3.models.total_volume_1 import TotalVolume1


class MarketData1(object):

    """Implementation of the 'MarketData1' model.

    coin market data

    Attributes:
        current_price (CurrentPrice1): coin current price
        market_cap (MarketCap1): coin market cap
        total_volume (TotalVolume1): coin total volume

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "current_price": 'current_price',
        "market_cap": 'market_cap',
        "total_volume": 'total_volume'
    }

    _optionals = [
        'current_price',
        'market_cap',
        'total_volume',
    ]

    def __init__(self,
                 current_price=APIHelper.SKIP,
                 market_cap=APIHelper.SKIP,
                 total_volume=APIHelper.SKIP):
        """Constructor for the MarketData1 class"""

        # Initialize members of the class
        if current_price is not APIHelper.SKIP:
            self.current_price = current_price 
        if market_cap is not APIHelper.SKIP:
            self.market_cap = market_cap 
        if total_volume is not APIHelper.SKIP:
            self.total_volume = total_volume 

    @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
        current_price = CurrentPrice1.from_dictionary(dictionary.get('current_price')) if 'current_price' in dictionary.keys() else APIHelper.SKIP
        market_cap = MarketCap1.from_dictionary(dictionary.get('market_cap')) if 'market_cap' in dictionary.keys() else APIHelper.SKIP
        total_volume = TotalVolume1.from_dictionary(dictionary.get('total_volume')) if 'total_volume' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(current_price,
                   market_cap,
                   total_volume)

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

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