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

"""
coingeckopublicapiv3

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


class SimpleTokenPrice(object):

    """Implementation of the 'SimpleTokenPrice' model.

    Attributes:
        usd (float): price in USD
        usd_market_cap (float): market cap in USD
        usd_24_h_vol (float): 24hr volume in USD
        usd_24_h_change (float): 24hr change in USD
        last_updated_at (float): last updated timestamp

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "usd": 'usd',
        "usd_market_cap": 'usd_market_cap',
        "usd_24_h_vol": 'usd_24h_vol',
        "usd_24_h_change": 'usd_24h_change',
        "last_updated_at": 'last_updated_at'
    }

    _optionals = [
        'usd',
        'usd_market_cap',
        'usd_24_h_vol',
        'usd_24_h_change',
        'last_updated_at',
    ]

    def __init__(self,
                 usd=APIHelper.SKIP,
                 usd_market_cap=APIHelper.SKIP,
                 usd_24_h_vol=APIHelper.SKIP,
                 usd_24_h_change=APIHelper.SKIP,
                 last_updated_at=APIHelper.SKIP):
        """Constructor for the SimpleTokenPrice class"""

        # Initialize members of the class
        if usd is not APIHelper.SKIP:
            self.usd = usd 
        if usd_market_cap is not APIHelper.SKIP:
            self.usd_market_cap = usd_market_cap 
        if usd_24_h_vol is not APIHelper.SKIP:
            self.usd_24_h_vol = usd_24_h_vol 
        if usd_24_h_change is not APIHelper.SKIP:
            self.usd_24_h_change = usd_24_h_change 
        if last_updated_at is not APIHelper.SKIP:
            self.last_updated_at = last_updated_at 

    @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
        usd = dictionary.get("usd") if dictionary.get("usd") else APIHelper.SKIP
        usd_market_cap = dictionary.get("usd_market_cap") if dictionary.get("usd_market_cap") else APIHelper.SKIP
        usd_24_h_vol = dictionary.get("usd_24h_vol") if dictionary.get("usd_24h_vol") else APIHelper.SKIP
        usd_24_h_change = dictionary.get("usd_24h_change") if dictionary.get("usd_24h_change") else APIHelper.SKIP
        last_updated_at = dictionary.get("last_updated_at") if dictionary.get("last_updated_at") else APIHelper.SKIP
        # Return an object of this model
        return cls(usd,
                   usd_market_cap,
                   usd_24_h_vol,
                   usd_24_h_change,
                   last_updated_at)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'usd={(self.usd if hasattr(self, "usd") else None)!r}, '
                f'usd_market_cap={(self.usd_market_cap if hasattr(self, "usd_market_cap") else None)!r}, '
                f'usd_24_h_vol={(self.usd_24_h_vol if hasattr(self, "usd_24_h_vol") else None)!r}, '
                f'usd_24_h_change={(self.usd_24_h_change if hasattr(self, "usd_24_h_change") else None)!r}, '
                f'last_updated_at={(self.last_updated_at if hasattr(self, "last_updated_at") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'usd={(self.usd if hasattr(self, "usd") else None)!s}, '
                f'usd_market_cap={(self.usd_market_cap if hasattr(self, "usd_market_cap") else None)!s}, '
                f'usd_24_h_vol={(self.usd_24_h_vol if hasattr(self, "usd_24_h_vol") else None)!s}, '
                f'usd_24_h_change={(self.usd_24_h_change if hasattr(self, "usd_24_h_change") else None)!s}, '
                f'last_updated_at={(self.last_updated_at if hasattr(self, "last_updated_at") else None)!s})')
