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

"""
coingeckopublicapiv3

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


class Data4(object):

    """Implementation of the 'Data4' model.

    Attributes:
        defi_market_cap (str): defi market cap
        eth_market_cap (str): eth market cap
        defi_to_eth_ratio (str): defi to eth ratio
        trading_volume_24_h (str): defi trading volume in 24 hours
        defi_dominance (str): defi dominance
        top_coin_name (str): defi top coin name
        top_coin_defi_dominance (float): defi top coin dominance

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "defi_market_cap": 'defi_market_cap',
        "eth_market_cap": 'eth_market_cap',
        "defi_to_eth_ratio": 'defi_to_eth_ratio',
        "trading_volume_24_h": 'trading_volume_24h',
        "defi_dominance": 'defi_dominance',
        "top_coin_name": 'top_coin_name',
        "top_coin_defi_dominance": 'top_coin_defi_dominance'
    }

    _optionals = [
        'defi_market_cap',
        'eth_market_cap',
        'defi_to_eth_ratio',
        'trading_volume_24_h',
        'defi_dominance',
        'top_coin_name',
        'top_coin_defi_dominance',
    ]

    def __init__(self,
                 defi_market_cap=APIHelper.SKIP,
                 eth_market_cap=APIHelper.SKIP,
                 defi_to_eth_ratio=APIHelper.SKIP,
                 trading_volume_24_h=APIHelper.SKIP,
                 defi_dominance=APIHelper.SKIP,
                 top_coin_name=APIHelper.SKIP,
                 top_coin_defi_dominance=APIHelper.SKIP):
        """Constructor for the Data4 class"""

        # Initialize members of the class
        if defi_market_cap is not APIHelper.SKIP:
            self.defi_market_cap = defi_market_cap 
        if eth_market_cap is not APIHelper.SKIP:
            self.eth_market_cap = eth_market_cap 
        if defi_to_eth_ratio is not APIHelper.SKIP:
            self.defi_to_eth_ratio = defi_to_eth_ratio 
        if trading_volume_24_h is not APIHelper.SKIP:
            self.trading_volume_24_h = trading_volume_24_h 
        if defi_dominance is not APIHelper.SKIP:
            self.defi_dominance = defi_dominance 
        if top_coin_name is not APIHelper.SKIP:
            self.top_coin_name = top_coin_name 
        if top_coin_defi_dominance is not APIHelper.SKIP:
            self.top_coin_defi_dominance = top_coin_defi_dominance 

    @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
        defi_market_cap = dictionary.get("defi_market_cap") if dictionary.get("defi_market_cap") else APIHelper.SKIP
        eth_market_cap = dictionary.get("eth_market_cap") if dictionary.get("eth_market_cap") else APIHelper.SKIP
        defi_to_eth_ratio = dictionary.get("defi_to_eth_ratio") if dictionary.get("defi_to_eth_ratio") else APIHelper.SKIP
        trading_volume_24_h = dictionary.get("trading_volume_24h") if dictionary.get("trading_volume_24h") else APIHelper.SKIP
        defi_dominance = dictionary.get("defi_dominance") if dictionary.get("defi_dominance") else APIHelper.SKIP
        top_coin_name = dictionary.get("top_coin_name") if dictionary.get("top_coin_name") else APIHelper.SKIP
        top_coin_defi_dominance = dictionary.get("top_coin_defi_dominance") if dictionary.get("top_coin_defi_dominance") else APIHelper.SKIP
        # Return an object of this model
        return cls(defi_market_cap,
                   eth_market_cap,
                   defi_to_eth_ratio,
                   trading_volume_24_h,
                   defi_dominance,
                   top_coin_name,
                   top_coin_defi_dominance)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'defi_market_cap={(self.defi_market_cap if hasattr(self, "defi_market_cap") else None)!r}, '
                f'eth_market_cap={(self.eth_market_cap if hasattr(self, "eth_market_cap") else None)!r}, '
                f'defi_to_eth_ratio={(self.defi_to_eth_ratio if hasattr(self, "defi_to_eth_ratio") else None)!r}, '
                f'trading_volume_24_h={(self.trading_volume_24_h if hasattr(self, "trading_volume_24_h") else None)!r}, '
                f'defi_dominance={(self.defi_dominance if hasattr(self, "defi_dominance") else None)!r}, '
                f'top_coin_name={(self.top_coin_name if hasattr(self, "top_coin_name") else None)!r}, '
                f'top_coin_defi_dominance={(self.top_coin_defi_dominance if hasattr(self, "top_coin_defi_dominance") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'defi_market_cap={(self.defi_market_cap if hasattr(self, "defi_market_cap") else None)!s}, '
                f'eth_market_cap={(self.eth_market_cap if hasattr(self, "eth_market_cap") else None)!s}, '
                f'defi_to_eth_ratio={(self.defi_to_eth_ratio if hasattr(self, "defi_to_eth_ratio") else None)!s}, '
                f'trading_volume_24_h={(self.trading_volume_24_h if hasattr(self, "trading_volume_24_h") else None)!s}, '
                f'defi_dominance={(self.defi_dominance if hasattr(self, "defi_dominance") else None)!s}, '
                f'top_coin_name={(self.top_coin_name if hasattr(self, "top_coin_name") else None)!s}, '
                f'top_coin_defi_dominance={(self.top_coin_defi_dominance if hasattr(self, "top_coin_defi_dominance") else None)!s})')
