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

"""
coingeckopublicapiv3

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


class Categories(object):

    """Implementation of the 'Categories' model.

    Attributes:
        id (str): category ID
        name (str): category name
        market_cap (float): category market cap
        market_cap_change_24_h (float): category market cap change in 24 hours
        content (str): category description
        top_3_coins_id (List[str]): IDs of top 3 coins in the category
        top_3_coins (List[str]): images of top 3 coins in the category
        volume_24_h (float): category volume in 24 hours
        updated_at (str): category last updated time

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'id',
        "name": 'name',
        "market_cap": 'market_cap',
        "market_cap_change_24_h": 'market_cap_change_24h',
        "content": 'content',
        "top_3_coins_id": 'top_3_coins_id',
        "top_3_coins": 'top_3_coins',
        "volume_24_h": 'volume_24h',
        "updated_at": 'updated_at'
    }

    _optionals = [
        'id',
        'name',
        'market_cap',
        'market_cap_change_24_h',
        'content',
        'top_3_coins_id',
        'top_3_coins',
        'volume_24_h',
        'updated_at',
    ]

    def __init__(self,
                 id=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 market_cap=APIHelper.SKIP,
                 market_cap_change_24_h=APIHelper.SKIP,
                 content=APIHelper.SKIP,
                 top_3_coins_id=APIHelper.SKIP,
                 top_3_coins=APIHelper.SKIP,
                 volume_24_h=APIHelper.SKIP,
                 updated_at=APIHelper.SKIP):
        """Constructor for the Categories 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 market_cap is not APIHelper.SKIP:
            self.market_cap = market_cap 
        if market_cap_change_24_h is not APIHelper.SKIP:
            self.market_cap_change_24_h = market_cap_change_24_h 
        if content is not APIHelper.SKIP:
            self.content = content 
        if top_3_coins_id is not APIHelper.SKIP:
            self.top_3_coins_id = top_3_coins_id 
        if top_3_coins is not APIHelper.SKIP:
            self.top_3_coins = top_3_coins 
        if volume_24_h is not APIHelper.SKIP:
            self.volume_24_h = volume_24_h 
        if updated_at is not APIHelper.SKIP:
            self.updated_at = 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
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        market_cap = dictionary.get("market_cap") if dictionary.get("market_cap") else APIHelper.SKIP
        market_cap_change_24_h = dictionary.get("market_cap_change_24h") if dictionary.get("market_cap_change_24h") else APIHelper.SKIP
        content = dictionary.get("content") if dictionary.get("content") else APIHelper.SKIP
        top_3_coins_id = dictionary.get("top_3_coins_id") if dictionary.get("top_3_coins_id") else APIHelper.SKIP
        top_3_coins = dictionary.get("top_3_coins") if dictionary.get("top_3_coins") else APIHelper.SKIP
        volume_24_h = dictionary.get("volume_24h") if dictionary.get("volume_24h") else APIHelper.SKIP
        updated_at = dictionary.get("updated_at") if dictionary.get("updated_at") else APIHelper.SKIP
        # Return an object of this model
        return cls(id,
                   name,
                   market_cap,
                   market_cap_change_24_h,
                   content,
                   top_3_coins_id,
                   top_3_coins,
                   volume_24_h,
                   updated_at)

    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'market_cap={(self.market_cap if hasattr(self, "market_cap") else None)!r}, '
                f'market_cap_change_24_h={(self.market_cap_change_24_h if hasattr(self, "market_cap_change_24_h") else None)!r}, '
                f'content={(self.content if hasattr(self, "content") else None)!r}, '
                f'top_3_coins_id={(self.top_3_coins_id if hasattr(self, "top_3_coins_id") else None)!r}, '
                f'top_3_coins={(self.top_3_coins if hasattr(self, "top_3_coins") else None)!r}, '
                f'volume_24_h={(self.volume_24_h if hasattr(self, "volume_24_h") else None)!r}, '
                f'updated_at={(self.updated_at if hasattr(self, "updated_at") 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'market_cap={(self.market_cap if hasattr(self, "market_cap") else None)!s}, '
                f'market_cap_change_24_h={(self.market_cap_change_24_h if hasattr(self, "market_cap_change_24_h") else None)!s}, '
                f'content={(self.content if hasattr(self, "content") else None)!s}, '
                f'top_3_coins_id={(self.top_3_coins_id if hasattr(self, "top_3_coins_id") else None)!s}, '
                f'top_3_coins={(self.top_3_coins if hasattr(self, "top_3_coins") else None)!s}, '
                f'volume_24_h={(self.volume_24_h if hasattr(self, "volume_24_h") else None)!s}, '
                f'updated_at={(self.updated_at if hasattr(self, "updated_at") else None)!s})')
