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

"""
coingeckopublicapiv3

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from coingeckopublicapiv3.api_helper import APIHelper
from coingeckopublicapiv3.models.categories_2 import Categories2
from coingeckopublicapiv3.models.coin_1 import Coin1
from coingeckopublicapiv3.models.nft_1 import Nft1


class TrendingSearch(object):

    """Implementation of the 'TrendingSearch' model.

    Attributes:
        coins (List[Coin1]): The model property of type List[Coin1].
        nfts (List[Nft1]): The model property of type List[Nft1].
        categories (List[Categories2]): The model property of type
            List[Categories2].

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "coins": 'coins',
        "nfts": 'nfts',
        "categories": 'categories'
    }

    _optionals = [
        'coins',
        'nfts',
        'categories',
    ]

    def __init__(self,
                 coins=APIHelper.SKIP,
                 nfts=APIHelper.SKIP,
                 categories=APIHelper.SKIP):
        """Constructor for the TrendingSearch class"""

        # Initialize members of the class
        if coins is not APIHelper.SKIP:
            self.coins = coins 
        if nfts is not APIHelper.SKIP:
            self.nfts = nfts 
        if categories is not APIHelper.SKIP:
            self.categories = categories 

    @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
        coins = None
        if dictionary.get('coins') is not None:
            coins = [Coin1.from_dictionary(x) for x in dictionary.get('coins')]
        else:
            coins = APIHelper.SKIP
        nfts = None
        if dictionary.get('nfts') is not None:
            nfts = [Nft1.from_dictionary(x) for x in dictionary.get('nfts')]
        else:
            nfts = APIHelper.SKIP
        categories = None
        if dictionary.get('categories') is not None:
            categories = [Categories2.from_dictionary(x) for x in dictionary.get('categories')]
        else:
            categories = APIHelper.SKIP
        # Return an object of this model
        return cls(coins,
                   nfts,
                   categories)

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

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