# -*- 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 import CommunityData
from coingeckopublicapiv3.models.developer_data import DeveloperData
from coingeckopublicapiv3.models.image import Image
from coingeckopublicapiv3.models.links import Links
from coingeckopublicapiv3.models.market_data import MarketData
from coingeckopublicapiv3.models.ticker import Ticker


class CoinsDataBase(object):

    """Implementation of the 'CoinsDataBase' model.

    Attributes:
        id (str): coin ID
        symbol (str): coin symbol
        name (str): coin name
        web_slug (str): coin web slug
        asset_platform_id (str): coin asset platform ID
        platforms (Dict[str, str]): coin asset platform and contract address
        detail_platforms (Dict[str, str]): detailed coin asset platform and
            contract address
        block_time_in_minutes (float): blockchain block time in minutes
        hashing_algorithm (str): blockchain hashing algorithm
        categories (List[str]): coin categories
        preview_listing (bool): preview listing coin
        public_notice (str): public notice
        additional_notices (List[str]): additional notices
        localization (Dict[str, str]): coin name localization
        description (Dict[str, str]): coin description
        links (Links): links
        image (Image): coin image url
        country_origin (str): coin country of origin
        genesis_date (datetime): coin genesis date
        sentiment_votes_up_percentage (float): coin sentiment votes up
            percentage
        sentiment_votes_down_percentage (float): coin sentiment votes down
            percentage
        watchlist_portfolio_users (float): number of users watching this coin
            in portfolio
        market_cap_rank (float): coin rank by market cap
        market_data (MarketData): coin market data
        community_data (CommunityData): coin community data
        developer_data (DeveloperData): coin developer data
        status_updates (List[str]): coin status updates
        last_updated (datetime): coin last updated timestamp
        tickers (List[Ticker]): coin tickers

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'id',
        "symbol": 'symbol',
        "name": 'name',
        "web_slug": 'web_slug',
        "asset_platform_id": 'asset_platform_id',
        "platforms": 'platforms',
        "detail_platforms": 'detail_platforms',
        "block_time_in_minutes": 'block_time_in_minutes',
        "hashing_algorithm": 'hashing_algorithm',
        "categories": 'categories',
        "preview_listing": 'preview_listing',
        "public_notice": 'public_notice',
        "additional_notices": 'additional_notices',
        "localization": 'localization',
        "description": 'description',
        "links": 'links',
        "image": 'image',
        "country_origin": 'country_origin',
        "genesis_date": 'genesis_date',
        "sentiment_votes_up_percentage": 'sentiment_votes_up_percentage',
        "sentiment_votes_down_percentage": 'sentiment_votes_down_percentage',
        "watchlist_portfolio_users": 'watchlist_portfolio_users',
        "market_cap_rank": 'market_cap_rank',
        "market_data": 'market_data',
        "community_data": 'community_data',
        "developer_data": 'developer_data',
        "status_updates": 'status_updates',
        "last_updated": 'last_updated',
        "tickers": 'tickers'
    }

    _optionals = [
        'id',
        'symbol',
        'name',
        'web_slug',
        'asset_platform_id',
        'platforms',
        'detail_platforms',
        'block_time_in_minutes',
        'hashing_algorithm',
        'categories',
        'preview_listing',
        'public_notice',
        'additional_notices',
        'localization',
        'description',
        'links',
        'image',
        'country_origin',
        'genesis_date',
        'sentiment_votes_up_percentage',
        'sentiment_votes_down_percentage',
        'watchlist_portfolio_users',
        'market_cap_rank',
        'market_data',
        'community_data',
        'developer_data',
        'status_updates',
        'last_updated',
        'tickers',
    ]

    def __init__(self,
                 id=APIHelper.SKIP,
                 symbol=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 web_slug=APIHelper.SKIP,
                 asset_platform_id=APIHelper.SKIP,
                 platforms=APIHelper.SKIP,
                 detail_platforms=APIHelper.SKIP,
                 block_time_in_minutes=APIHelper.SKIP,
                 hashing_algorithm=APIHelper.SKIP,
                 categories=APIHelper.SKIP,
                 preview_listing=APIHelper.SKIP,
                 public_notice=APIHelper.SKIP,
                 additional_notices=APIHelper.SKIP,
                 localization=APIHelper.SKIP,
                 description=APIHelper.SKIP,
                 links=APIHelper.SKIP,
                 image=APIHelper.SKIP,
                 country_origin=APIHelper.SKIP,
                 genesis_date=APIHelper.SKIP,
                 sentiment_votes_up_percentage=APIHelper.SKIP,
                 sentiment_votes_down_percentage=APIHelper.SKIP,
                 watchlist_portfolio_users=APIHelper.SKIP,
                 market_cap_rank=APIHelper.SKIP,
                 market_data=APIHelper.SKIP,
                 community_data=APIHelper.SKIP,
                 developer_data=APIHelper.SKIP,
                 status_updates=APIHelper.SKIP,
                 last_updated=APIHelper.SKIP,
                 tickers=APIHelper.SKIP):
        """Constructor for the CoinsDataBase 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 web_slug is not APIHelper.SKIP:
            self.web_slug = web_slug 
        if asset_platform_id is not APIHelper.SKIP:
            self.asset_platform_id = asset_platform_id 
        if platforms is not APIHelper.SKIP:
            self.platforms = platforms 
        if detail_platforms is not APIHelper.SKIP:
            self.detail_platforms = detail_platforms 
        if block_time_in_minutes is not APIHelper.SKIP:
            self.block_time_in_minutes = block_time_in_minutes 
        if hashing_algorithm is not APIHelper.SKIP:
            self.hashing_algorithm = hashing_algorithm 
        if categories is not APIHelper.SKIP:
            self.categories = categories 
        if preview_listing is not APIHelper.SKIP:
            self.preview_listing = preview_listing 
        if public_notice is not APIHelper.SKIP:
            self.public_notice = public_notice 
        if additional_notices is not APIHelper.SKIP:
            self.additional_notices = additional_notices 
        if localization is not APIHelper.SKIP:
            self.localization = localization 
        if description is not APIHelper.SKIP:
            self.description = description 
        if links is not APIHelper.SKIP:
            self.links = links 
        if image is not APIHelper.SKIP:
            self.image = image 
        if country_origin is not APIHelper.SKIP:
            self.country_origin = country_origin 
        if genesis_date is not APIHelper.SKIP:
            self.genesis_date = APIHelper.apply_datetime_converter(genesis_date, APIHelper.RFC3339DateTime) if genesis_date else None 
        if sentiment_votes_up_percentage is not APIHelper.SKIP:
            self.sentiment_votes_up_percentage = sentiment_votes_up_percentage 
        if sentiment_votes_down_percentage is not APIHelper.SKIP:
            self.sentiment_votes_down_percentage = sentiment_votes_down_percentage 
        if watchlist_portfolio_users is not APIHelper.SKIP:
            self.watchlist_portfolio_users = watchlist_portfolio_users 
        if market_cap_rank is not APIHelper.SKIP:
            self.market_cap_rank = market_cap_rank 
        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 status_updates is not APIHelper.SKIP:
            self.status_updates = status_updates 
        if last_updated is not APIHelper.SKIP:
            self.last_updated = APIHelper.apply_datetime_converter(last_updated, APIHelper.RFC3339DateTime) if last_updated else None 
        if tickers is not APIHelper.SKIP:
            self.tickers = tickers 

    @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
        web_slug = dictionary.get("web_slug") if dictionary.get("web_slug") else APIHelper.SKIP
        asset_platform_id = dictionary.get("asset_platform_id") if dictionary.get("asset_platform_id") else APIHelper.SKIP
        platforms = dictionary.get("platforms") if dictionary.get("platforms") else APIHelper.SKIP
        detail_platforms = dictionary.get("detail_platforms") if dictionary.get("detail_platforms") else APIHelper.SKIP
        block_time_in_minutes = dictionary.get("block_time_in_minutes") if dictionary.get("block_time_in_minutes") else APIHelper.SKIP
        hashing_algorithm = dictionary.get("hashing_algorithm") if dictionary.get("hashing_algorithm") else APIHelper.SKIP
        categories = dictionary.get("categories") if dictionary.get("categories") else APIHelper.SKIP
        preview_listing = dictionary.get("preview_listing") if "preview_listing" in dictionary.keys() else APIHelper.SKIP
        public_notice = dictionary.get("public_notice") if dictionary.get("public_notice") else APIHelper.SKIP
        additional_notices = dictionary.get("additional_notices") if dictionary.get("additional_notices") else APIHelper.SKIP
        localization = dictionary.get("localization") if dictionary.get("localization") else APIHelper.SKIP
        description = dictionary.get("description") if dictionary.get("description") else APIHelper.SKIP
        links = Links.from_dictionary(dictionary.get('links')) if 'links' in dictionary.keys() else APIHelper.SKIP
        image = Image.from_dictionary(dictionary.get('image')) if 'image' in dictionary.keys() else APIHelper.SKIP
        country_origin = dictionary.get("country_origin") if dictionary.get("country_origin") else APIHelper.SKIP
        genesis_date = APIHelper.RFC3339DateTime.from_value(dictionary.get("genesis_date")).datetime if dictionary.get("genesis_date") else APIHelper.SKIP
        sentiment_votes_up_percentage = dictionary.get("sentiment_votes_up_percentage") if dictionary.get("sentiment_votes_up_percentage") else APIHelper.SKIP
        sentiment_votes_down_percentage = dictionary.get("sentiment_votes_down_percentage") if dictionary.get("sentiment_votes_down_percentage") else APIHelper.SKIP
        watchlist_portfolio_users = dictionary.get("watchlist_portfolio_users") if dictionary.get("watchlist_portfolio_users") else APIHelper.SKIP
        market_cap_rank = dictionary.get("market_cap_rank") if dictionary.get("market_cap_rank") else APIHelper.SKIP
        market_data = MarketData.from_dictionary(dictionary.get('market_data')) if 'market_data' in dictionary.keys() else APIHelper.SKIP
        community_data = CommunityData.from_dictionary(dictionary.get('community_data')) if 'community_data' in dictionary.keys() else APIHelper.SKIP
        developer_data = DeveloperData.from_dictionary(dictionary.get('developer_data')) if 'developer_data' in dictionary.keys() else APIHelper.SKIP
        status_updates = dictionary.get("status_updates") if dictionary.get("status_updates") else APIHelper.SKIP
        last_updated = APIHelper.RFC3339DateTime.from_value(dictionary.get("last_updated")).datetime if dictionary.get("last_updated") else APIHelper.SKIP
        tickers = None
        if dictionary.get('tickers') is not None:
            tickers = [Ticker.from_dictionary(x) for x in dictionary.get('tickers')]
        else:
            tickers = APIHelper.SKIP
        # Return an object of this model
        return cls(id,
                   symbol,
                   name,
                   web_slug,
                   asset_platform_id,
                   platforms,
                   detail_platforms,
                   block_time_in_minutes,
                   hashing_algorithm,
                   categories,
                   preview_listing,
                   public_notice,
                   additional_notices,
                   localization,
                   description,
                   links,
                   image,
                   country_origin,
                   genesis_date,
                   sentiment_votes_up_percentage,
                   sentiment_votes_down_percentage,
                   watchlist_portfolio_users,
                   market_cap_rank,
                   market_data,
                   community_data,
                   developer_data,
                   status_updates,
                   last_updated,
                   tickers)

    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'web_slug={(self.web_slug if hasattr(self, "web_slug") else None)!r}, '
                f'asset_platform_id={(self.asset_platform_id if hasattr(self, "asset_platform_id") else None)!r}, '
                f'platforms={(self.platforms if hasattr(self, "platforms") else None)!r}, '
                f'detail_platforms={(self.detail_platforms if hasattr(self, "detail_platforms") else None)!r}, '
                f'block_time_in_minutes={(self.block_time_in_minutes if hasattr(self, "block_time_in_minutes") else None)!r}, '
                f'hashing_algorithm={(self.hashing_algorithm if hasattr(self, "hashing_algorithm") else None)!r}, '
                f'categories={(self.categories if hasattr(self, "categories") else None)!r}, '
                f'preview_listing={(self.preview_listing if hasattr(self, "preview_listing") else None)!r}, '
                f'public_notice={(self.public_notice if hasattr(self, "public_notice") else None)!r}, '
                f'additional_notices={(self.additional_notices if hasattr(self, "additional_notices") else None)!r}, '
                f'localization={(self.localization if hasattr(self, "localization") else None)!r}, '
                f'description={(self.description if hasattr(self, "description") else None)!r}, '
                f'links={(self.links if hasattr(self, "links") else None)!r}, '
                f'image={(self.image if hasattr(self, "image") else None)!r}, '
                f'country_origin={(self.country_origin if hasattr(self, "country_origin") else None)!r}, '
                f'genesis_date={(self.genesis_date if hasattr(self, "genesis_date") else None)!r}, '
                f'sentiment_votes_up_percentage={(self.sentiment_votes_up_percentage if hasattr(self, "sentiment_votes_up_percentage") else None)!r}, '
                f'sentiment_votes_down_percentage={(self.sentiment_votes_down_percentage if hasattr(self, "sentiment_votes_down_percentage") else None)!r}, '
                f'watchlist_portfolio_users={(self.watchlist_portfolio_users if hasattr(self, "watchlist_portfolio_users") else None)!r}, '
                f'market_cap_rank={(self.market_cap_rank if hasattr(self, "market_cap_rank") 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'status_updates={(self.status_updates if hasattr(self, "status_updates") else None)!r}, '
                f'last_updated={(self.last_updated if hasattr(self, "last_updated") else None)!r}, '
                f'tickers={(self.tickers if hasattr(self, "tickers") 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'web_slug={(self.web_slug if hasattr(self, "web_slug") else None)!s}, '
                f'asset_platform_id={(self.asset_platform_id if hasattr(self, "asset_platform_id") else None)!s}, '
                f'platforms={(self.platforms if hasattr(self, "platforms") else None)!s}, '
                f'detail_platforms={(self.detail_platforms if hasattr(self, "detail_platforms") else None)!s}, '
                f'block_time_in_minutes={(self.block_time_in_minutes if hasattr(self, "block_time_in_minutes") else None)!s}, '
                f'hashing_algorithm={(self.hashing_algorithm if hasattr(self, "hashing_algorithm") else None)!s}, '
                f'categories={(self.categories if hasattr(self, "categories") else None)!s}, '
                f'preview_listing={(self.preview_listing if hasattr(self, "preview_listing") else None)!s}, '
                f'public_notice={(self.public_notice if hasattr(self, "public_notice") else None)!s}, '
                f'additional_notices={(self.additional_notices if hasattr(self, "additional_notices") else None)!s}, '
                f'localization={(self.localization if hasattr(self, "localization") else None)!s}, '
                f'description={(self.description if hasattr(self, "description") else None)!s}, '
                f'links={(self.links if hasattr(self, "links") else None)!s}, '
                f'image={(self.image if hasattr(self, "image") else None)!s}, '
                f'country_origin={(self.country_origin if hasattr(self, "country_origin") else None)!s}, '
                f'genesis_date={(self.genesis_date if hasattr(self, "genesis_date") else None)!s}, '
                f'sentiment_votes_up_percentage={(self.sentiment_votes_up_percentage if hasattr(self, "sentiment_votes_up_percentage") else None)!s}, '
                f'sentiment_votes_down_percentage={(self.sentiment_votes_down_percentage if hasattr(self, "sentiment_votes_down_percentage") else None)!s}, '
                f'watchlist_portfolio_users={(self.watchlist_portfolio_users if hasattr(self, "watchlist_portfolio_users") else None)!s}, '
                f'market_cap_rank={(self.market_cap_rank if hasattr(self, "market_cap_rank") 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'status_updates={(self.status_updates if hasattr(self, "status_updates") else None)!s}, '
                f'last_updated={(self.last_updated if hasattr(self, "last_updated") else None)!s}, '
                f'tickers={(self.tickers if hasattr(self, "tickers") else None)!s})')
