# -*- 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.community_data_1 import CommunityData1
from coingeckopublicapiv3.models.developer_data_1 import DeveloperData1
from coingeckopublicapiv3.models.image_1 import Image1
from coingeckopublicapiv3.models.market_data_1 import MarketData1
from coingeckopublicapiv3.models.public_interest_stats import PublicInterestStats


class CoinsHistoricalData(object):

    """Implementation of the 'CoinsHistoricalData' model.

    Attributes:
        id (str): coin ID
        symbol (str): coin symbol
        name (str): coin name
        localization (Dict[str, str]): coin localization
        image (Image1): coin image url
        market_data (MarketData1): coin market data
        community_data (CommunityData1): coin community data
        developer_data (DeveloperData1): coin developer data
        public_interest_stats (PublicInterestStats): coin public interest stats

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'id',
        "symbol": 'symbol',
        "name": 'name',
        "localization": 'localization',
        "image": 'image',
        "market_data": 'market_data',
        "community_data": 'community_data',
        "developer_data": 'developer_data',
        "public_interest_stats": 'public_interest_stats'
    }

    _optionals = [
        'id',
        'symbol',
        'name',
        'localization',
        'image',
        'market_data',
        'community_data',
        'developer_data',
        'public_interest_stats',
    ]

    def __init__(self,
                 id=APIHelper.SKIP,
                 symbol=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 localization=APIHelper.SKIP,
                 image=APIHelper.SKIP,
                 market_data=APIHelper.SKIP,
                 community_data=APIHelper.SKIP,
                 developer_data=APIHelper.SKIP,
                 public_interest_stats=APIHelper.SKIP):
        """Constructor for the CoinsHistoricalData class"""

        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id 
        if symbol is not APIHelper.SKIP:
            self.symbol = symbol 
        if name is not APIHelper.SKIP:
            self.name = name 
        if localization is not APIHelper.SKIP:
            self.localization = localization 
        if image is not APIHelper.SKIP:
            self.image = image 
        if market_data is not APIHelper.SKIP:
            self.market_data = market_data 
        if community_data is not APIHelper.SKIP:
            self.community_data = community_data 
        if developer_data is not APIHelper.SKIP:
            self.developer_data = developer_data 
        if public_interest_stats is not APIHelper.SKIP:
            self.public_interest_stats = public_interest_stats 

    @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
        symbol = dictionary.get("symbol") if dictionary.get("symbol") else APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        localization = dictionary.get("localization") if dictionary.get("localization") else APIHelper.SKIP
        image = Image1.from_dictionary(dictionary.get('image')) if 'image' in dictionary.keys() else APIHelper.SKIP
        market_data = MarketData1.from_dictionary(dictionary.get('market_data')) if 'market_data' in dictionary.keys() else APIHelper.SKIP
        community_data = CommunityData1.from_dictionary(dictionary.get('community_data')) if 'community_data' in dictionary.keys() else APIHelper.SKIP
        developer_data = DeveloperData1.from_dictionary(dictionary.get('developer_data')) if 'developer_data' in dictionary.keys() else APIHelper.SKIP
        public_interest_stats = PublicInterestStats.from_dictionary(dictionary.get('public_interest_stats')) if 'public_interest_stats' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(id,
                   symbol,
                   name,
                   localization,
                   image,
                   market_data,
                   community_data,
                   developer_data,
                   public_interest_stats)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'id={(self.id if hasattr(self, "id") else None)!r}, '
                f'symbol={(self.symbol if hasattr(self, "symbol") else None)!r}, '
                f'name={(self.name if hasattr(self, "name") else None)!r}, '
                f'localization={(self.localization if hasattr(self, "localization") else None)!r}, '
                f'image={(self.image if hasattr(self, "image") else None)!r}, '
                f'market_data={(self.market_data if hasattr(self, "market_data") else None)!r}, '
                f'community_data={(self.community_data if hasattr(self, "community_data") else None)!r}, '
                f'developer_data={(self.developer_data if hasattr(self, "developer_data") else None)!r}, '
                f'public_interest_stats={(self.public_interest_stats if hasattr(self, "public_interest_stats") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'id={(self.id if hasattr(self, "id") else None)!s}, '
                f'symbol={(self.symbol if hasattr(self, "symbol") else None)!s}, '
                f'name={(self.name if hasattr(self, "name") else None)!s}, '
                f'localization={(self.localization if hasattr(self, "localization") else None)!s}, '
                f'image={(self.image if hasattr(self, "image") else None)!s}, '
                f'market_data={(self.market_data if hasattr(self, "market_data") else None)!s}, '
                f'community_data={(self.community_data if hasattr(self, "community_data") else None)!s}, '
                f'developer_data={(self.developer_data if hasattr(self, "developer_data") else None)!s}, '
                f'public_interest_stats={(self.public_interest_stats if hasattr(self, "public_interest_stats") else None)!s})')
