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

"""
coingeckopublicapiv3

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


class Coin(object):

    """Implementation of the 'Coin' model.

    Attributes:
        id (str): coin ID
        name (str): coin name
        api_symbol (str): coin api symbol
        symbol (str): coin symbol
        market_cap_rank (float): coin market cap rank
        thumb (str): coin thumb image url
        large (str): coin large image url

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'id',
        "name": 'name',
        "api_symbol": 'api_symbol',
        "symbol": 'symbol',
        "market_cap_rank": 'market_cap_rank',
        "thumb": 'thumb',
        "large": 'large'
    }

    _optionals = [
        'id',
        'name',
        'api_symbol',
        'symbol',
        'market_cap_rank',
        'thumb',
        'large',
    ]

    def __init__(self,
                 id=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 api_symbol=APIHelper.SKIP,
                 symbol=APIHelper.SKIP,
                 market_cap_rank=APIHelper.SKIP,
                 thumb=APIHelper.SKIP,
                 large=APIHelper.SKIP):
        """Constructor for the Coin class"""

        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id 
        if name is not APIHelper.SKIP:
            self.name = name 
        if api_symbol is not APIHelper.SKIP:
            self.api_symbol = api_symbol 
        if symbol is not APIHelper.SKIP:
            self.symbol = symbol 
        if market_cap_rank is not APIHelper.SKIP:
            self.market_cap_rank = market_cap_rank 
        if thumb is not APIHelper.SKIP:
            self.thumb = thumb 
        if large is not APIHelper.SKIP:
            self.large = large 

    @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
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        api_symbol = dictionary.get("api_symbol") if dictionary.get("api_symbol") else APIHelper.SKIP
        symbol = dictionary.get("symbol") if dictionary.get("symbol") else APIHelper.SKIP
        market_cap_rank = dictionary.get("market_cap_rank") if dictionary.get("market_cap_rank") else APIHelper.SKIP
        thumb = dictionary.get("thumb") if dictionary.get("thumb") else APIHelper.SKIP
        large = dictionary.get("large") if dictionary.get("large") else APIHelper.SKIP
        # Return an object of this model
        return cls(id,
                   name,
                   api_symbol,
                   symbol,
                   market_cap_rank,
                   thumb,
                   large)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'id={(self.id if hasattr(self, "id") else None)!r}, '
                f'name={(self.name if hasattr(self, "name") else None)!r}, '
                f'api_symbol={(self.api_symbol if hasattr(self, "api_symbol") else None)!r}, '
                f'symbol={(self.symbol if hasattr(self, "symbol") else None)!r}, '
                f'market_cap_rank={(self.market_cap_rank if hasattr(self, "market_cap_rank") else None)!r}, '
                f'thumb={(self.thumb if hasattr(self, "thumb") else None)!r}, '
                f'large={(self.large if hasattr(self, "large") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'id={(self.id if hasattr(self, "id") else None)!s}, '
                f'name={(self.name if hasattr(self, "name") else None)!s}, '
                f'api_symbol={(self.api_symbol if hasattr(self, "api_symbol") else None)!s}, '
                f'symbol={(self.symbol if hasattr(self, "symbol") else None)!s}, '
                f'market_cap_rank={(self.market_cap_rank if hasattr(self, "market_cap_rank") else None)!s}, '
                f'thumb={(self.thumb if hasattr(self, "thumb") else None)!s}, '
                f'large={(self.large if hasattr(self, "large") else None)!s})')
