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

"""
coingeckopublicapiv3

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


class Token(object):

    """Implementation of the 'Token' model.

    Attributes:
        chain_id (float): chainlist's chain ID
        address (str): token contract address
        name (str): token name
        symbol (str): token symbol
        decimals (float): token decimals
        logo_uri (str): token image url

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "chain_id": 'chainId',
        "address": 'address',
        "name": 'name',
        "symbol": 'symbol',
        "decimals": 'decimals',
        "logo_uri": 'logoURI'
    }

    _optionals = [
        'chain_id',
        'address',
        'name',
        'symbol',
        'decimals',
        'logo_uri',
    ]

    def __init__(self,
                 chain_id=APIHelper.SKIP,
                 address=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 symbol=APIHelper.SKIP,
                 decimals=APIHelper.SKIP,
                 logo_uri=APIHelper.SKIP):
        """Constructor for the Token class"""

        # Initialize members of the class
        if chain_id is not APIHelper.SKIP:
            self.chain_id = chain_id 
        if address is not APIHelper.SKIP:
            self.address = address 
        if name is not APIHelper.SKIP:
            self.name = name 
        if symbol is not APIHelper.SKIP:
            self.symbol = symbol 
        if decimals is not APIHelper.SKIP:
            self.decimals = decimals 
        if logo_uri is not APIHelper.SKIP:
            self.logo_uri = logo_uri 

    @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
        chain_id = dictionary.get("chainId") if dictionary.get("chainId") else APIHelper.SKIP
        address = dictionary.get("address") if dictionary.get("address") else APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        symbol = dictionary.get("symbol") if dictionary.get("symbol") else APIHelper.SKIP
        decimals = dictionary.get("decimals") if dictionary.get("decimals") else APIHelper.SKIP
        logo_uri = dictionary.get("logoURI") if dictionary.get("logoURI") else APIHelper.SKIP
        # Return an object of this model
        return cls(chain_id,
                   address,
                   name,
                   symbol,
                   decimals,
                   logo_uri)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'chain_id={(self.chain_id if hasattr(self, "chain_id") else None)!r}, '
                f'address={(self.address if hasattr(self, "address") else None)!r}, '
                f'name={(self.name if hasattr(self, "name") else None)!r}, '
                f'symbol={(self.symbol if hasattr(self, "symbol") else None)!r}, '
                f'decimals={(self.decimals if hasattr(self, "decimals") else None)!r}, '
                f'logo_uri={(self.logo_uri if hasattr(self, "logo_uri") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'chain_id={(self.chain_id if hasattr(self, "chain_id") else None)!s}, '
                f'address={(self.address if hasattr(self, "address") else None)!s}, '
                f'name={(self.name if hasattr(self, "name") else None)!s}, '
                f'symbol={(self.symbol if hasattr(self, "symbol") else None)!s}, '
                f'decimals={(self.decimals if hasattr(self, "decimals") else None)!s}, '
                f'logo_uri={(self.logo_uri if hasattr(self, "logo_uri") else None)!s})')
