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

"""
coingeckopublicapiv3

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


class PublicInterestStats(object):

    """Implementation of the 'PublicInterestStats' model.

    coin public interest stats

    Attributes:
        alexa_rank (float): coin alexa rank
        bing_matches (float): coin bing matches

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "alexa_rank": 'alexa_rank',
        "bing_matches": 'bing_matches'
    }

    _optionals = [
        'alexa_rank',
        'bing_matches',
    ]

    def __init__(self,
                 alexa_rank=APIHelper.SKIP,
                 bing_matches=APIHelper.SKIP):
        """Constructor for the PublicInterestStats class"""

        # Initialize members of the class
        if alexa_rank is not APIHelper.SKIP:
            self.alexa_rank = alexa_rank 
        if bing_matches is not APIHelper.SKIP:
            self.bing_matches = bing_matches 

    @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
        alexa_rank = dictionary.get("alexa_rank") if dictionary.get("alexa_rank") else APIHelper.SKIP
        bing_matches = dictionary.get("bing_matches") if dictionary.get("bing_matches") else APIHelper.SKIP
        # Return an object of this model
        return cls(alexa_rank,
                   bing_matches)

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

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