# -*- 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.converted_last import ConvertedLast
from coingeckopublicapiv3.models.converted_volume import ConvertedVolume
from coingeckopublicapiv3.models.market_1 import Market1


class Ticker1(object):

    """Implementation of the 'Ticker1' model.

    Attributes:
        base (str): coin ticker base currency
        target (str): coin ticker target currency
        market (Market1): coin ticker exchange
        last (float): coin ticker last price
        volume (float): coin ticker volume
        cost_to_move_up_usd (float): coin ticker cost to move up in usd
        cost_to_move_down_usd (float): coin ticker cost to move down in usd
        converted_last (ConvertedLast): coin ticker converted last price
        converted_volume (ConvertedVolume): coin ticker converted volume
        trust_score (str): coin ticker trust score
        bid_ask_spread_percentage (float): coin ticker bid ask spread
            percentage
        timestamp (str): coin ticker timestamp
        last_traded_at (str): coin ticker last traded timestamp
        last_fetch_at (str): coin ticker last fetch timestamp
        is_anomaly (bool): coin ticker anomaly
        is_stale (bool): coin ticker stale
        trade_url (str): coin ticker trade url
        token_info_url (str): coin ticker token info url
        coin_id (str): coin ticker base currency coin ID
        target_coin_id (str): coin ticker target currency coin ID

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "base": 'base',
        "target": 'target',
        "market": 'market',
        "last": 'last',
        "volume": 'volume',
        "cost_to_move_up_usd": 'cost_to_move_up_usd',
        "cost_to_move_down_usd": 'cost_to_move_down_usd',
        "converted_last": 'converted_last',
        "converted_volume": 'converted_volume',
        "trust_score": 'trust_score',
        "bid_ask_spread_percentage": 'bid_ask_spread_percentage',
        "timestamp": 'timestamp',
        "last_traded_at": 'last_traded_at',
        "last_fetch_at": 'last_fetch_at',
        "is_anomaly": 'is_anomaly',
        "is_stale": 'is_stale',
        "trade_url": 'trade_url',
        "token_info_url": 'token_info_url',
        "coin_id": 'coin_id',
        "target_coin_id": 'target_coin_id'
    }

    _optionals = [
        'base',
        'target',
        'market',
        'last',
        'volume',
        'cost_to_move_up_usd',
        'cost_to_move_down_usd',
        'converted_last',
        'converted_volume',
        'trust_score',
        'bid_ask_spread_percentage',
        'timestamp',
        'last_traded_at',
        'last_fetch_at',
        'is_anomaly',
        'is_stale',
        'trade_url',
        'token_info_url',
        'coin_id',
        'target_coin_id',
    ]

    _nullables = [
        'token_info_url',
    ]

    def __init__(self,
                 base=APIHelper.SKIP,
                 target=APIHelper.SKIP,
                 market=APIHelper.SKIP,
                 last=APIHelper.SKIP,
                 volume=APIHelper.SKIP,
                 cost_to_move_up_usd=APIHelper.SKIP,
                 cost_to_move_down_usd=APIHelper.SKIP,
                 converted_last=APIHelper.SKIP,
                 converted_volume=APIHelper.SKIP,
                 trust_score=APIHelper.SKIP,
                 bid_ask_spread_percentage=APIHelper.SKIP,
                 timestamp=APIHelper.SKIP,
                 last_traded_at=APIHelper.SKIP,
                 last_fetch_at=APIHelper.SKIP,
                 is_anomaly=APIHelper.SKIP,
                 is_stale=APIHelper.SKIP,
                 trade_url=APIHelper.SKIP,
                 token_info_url=APIHelper.SKIP,
                 coin_id=APIHelper.SKIP,
                 target_coin_id=APIHelper.SKIP):
        """Constructor for the Ticker1 class"""

        # Initialize members of the class
        if base is not APIHelper.SKIP:
            self.base = base 
        if target is not APIHelper.SKIP:
            self.target = target 
        if market is not APIHelper.SKIP:
            self.market = market 
        if last is not APIHelper.SKIP:
            self.last = last 
        if volume is not APIHelper.SKIP:
            self.volume = volume 
        if cost_to_move_up_usd is not APIHelper.SKIP:
            self.cost_to_move_up_usd = cost_to_move_up_usd 
        if cost_to_move_down_usd is not APIHelper.SKIP:
            self.cost_to_move_down_usd = cost_to_move_down_usd 
        if converted_last is not APIHelper.SKIP:
            self.converted_last = converted_last 
        if converted_volume is not APIHelper.SKIP:
            self.converted_volume = converted_volume 
        if trust_score is not APIHelper.SKIP:
            self.trust_score = trust_score 
        if bid_ask_spread_percentage is not APIHelper.SKIP:
            self.bid_ask_spread_percentage = bid_ask_spread_percentage 
        if timestamp is not APIHelper.SKIP:
            self.timestamp = timestamp 
        if last_traded_at is not APIHelper.SKIP:
            self.last_traded_at = last_traded_at 
        if last_fetch_at is not APIHelper.SKIP:
            self.last_fetch_at = last_fetch_at 
        if is_anomaly is not APIHelper.SKIP:
            self.is_anomaly = is_anomaly 
        if is_stale is not APIHelper.SKIP:
            self.is_stale = is_stale 
        if trade_url is not APIHelper.SKIP:
            self.trade_url = trade_url 
        if token_info_url is not APIHelper.SKIP:
            self.token_info_url = token_info_url 
        if coin_id is not APIHelper.SKIP:
            self.coin_id = coin_id 
        if target_coin_id is not APIHelper.SKIP:
            self.target_coin_id = target_coin_id 

    @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
        base = dictionary.get("base") if dictionary.get("base") else APIHelper.SKIP
        target = dictionary.get("target") if dictionary.get("target") else APIHelper.SKIP
        market = Market1.from_dictionary(dictionary.get('market')) if 'market' in dictionary.keys() else APIHelper.SKIP
        last = dictionary.get("last") if dictionary.get("last") else APIHelper.SKIP
        volume = dictionary.get("volume") if dictionary.get("volume") else APIHelper.SKIP
        cost_to_move_up_usd = dictionary.get("cost_to_move_up_usd") if dictionary.get("cost_to_move_up_usd") else APIHelper.SKIP
        cost_to_move_down_usd = dictionary.get("cost_to_move_down_usd") if dictionary.get("cost_to_move_down_usd") else APIHelper.SKIP
        converted_last = ConvertedLast.from_dictionary(dictionary.get('converted_last')) if 'converted_last' in dictionary.keys() else APIHelper.SKIP
        converted_volume = ConvertedVolume.from_dictionary(dictionary.get('converted_volume')) if 'converted_volume' in dictionary.keys() else APIHelper.SKIP
        trust_score = dictionary.get("trust_score") if dictionary.get("trust_score") else APIHelper.SKIP
        bid_ask_spread_percentage = dictionary.get("bid_ask_spread_percentage") if dictionary.get("bid_ask_spread_percentage") else APIHelper.SKIP
        timestamp = dictionary.get("timestamp") if dictionary.get("timestamp") else APIHelper.SKIP
        last_traded_at = dictionary.get("last_traded_at") if dictionary.get("last_traded_at") else APIHelper.SKIP
        last_fetch_at = dictionary.get("last_fetch_at") if dictionary.get("last_fetch_at") else APIHelper.SKIP
        is_anomaly = dictionary.get("is_anomaly") if "is_anomaly" in dictionary.keys() else APIHelper.SKIP
        is_stale = dictionary.get("is_stale") if "is_stale" in dictionary.keys() else APIHelper.SKIP
        trade_url = dictionary.get("trade_url") if dictionary.get("trade_url") else APIHelper.SKIP
        token_info_url = dictionary.get("token_info_url") if "token_info_url" in dictionary.keys() else APIHelper.SKIP
        coin_id = dictionary.get("coin_id") if dictionary.get("coin_id") else APIHelper.SKIP
        target_coin_id = dictionary.get("target_coin_id") if dictionary.get("target_coin_id") else APIHelper.SKIP
        # Return an object of this model
        return cls(base,
                   target,
                   market,
                   last,
                   volume,
                   cost_to_move_up_usd,
                   cost_to_move_down_usd,
                   converted_last,
                   converted_volume,
                   trust_score,
                   bid_ask_spread_percentage,
                   timestamp,
                   last_traded_at,
                   last_fetch_at,
                   is_anomaly,
                   is_stale,
                   trade_url,
                   token_info_url,
                   coin_id,
                   target_coin_id)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'base={(self.base if hasattr(self, "base") else None)!r}, '
                f'target={(self.target if hasattr(self, "target") else None)!r}, '
                f'market={(self.market if hasattr(self, "market") else None)!r}, '
                f'last={(self.last if hasattr(self, "last") else None)!r}, '
                f'volume={(self.volume if hasattr(self, "volume") else None)!r}, '
                f'cost_to_move_up_usd={(self.cost_to_move_up_usd if hasattr(self, "cost_to_move_up_usd") else None)!r}, '
                f'cost_to_move_down_usd={(self.cost_to_move_down_usd if hasattr(self, "cost_to_move_down_usd") else None)!r}, '
                f'converted_last={(self.converted_last if hasattr(self, "converted_last") else None)!r}, '
                f'converted_volume={(self.converted_volume if hasattr(self, "converted_volume") else None)!r}, '
                f'trust_score={(self.trust_score if hasattr(self, "trust_score") else None)!r}, '
                f'bid_ask_spread_percentage={(self.bid_ask_spread_percentage if hasattr(self, "bid_ask_spread_percentage") else None)!r}, '
                f'timestamp={(self.timestamp if hasattr(self, "timestamp") else None)!r}, '
                f'last_traded_at={(self.last_traded_at if hasattr(self, "last_traded_at") else None)!r}, '
                f'last_fetch_at={(self.last_fetch_at if hasattr(self, "last_fetch_at") else None)!r}, '
                f'is_anomaly={(self.is_anomaly if hasattr(self, "is_anomaly") else None)!r}, '
                f'is_stale={(self.is_stale if hasattr(self, "is_stale") else None)!r}, '
                f'trade_url={(self.trade_url if hasattr(self, "trade_url") else None)!r}, '
                f'token_info_url={(self.token_info_url if hasattr(self, "token_info_url") else None)!r}, '
                f'coin_id={(self.coin_id if hasattr(self, "coin_id") else None)!r}, '
                f'target_coin_id={(self.target_coin_id if hasattr(self, "target_coin_id") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'base={(self.base if hasattr(self, "base") else None)!s}, '
                f'target={(self.target if hasattr(self, "target") else None)!s}, '
                f'market={(self.market if hasattr(self, "market") else None)!s}, '
                f'last={(self.last if hasattr(self, "last") else None)!s}, '
                f'volume={(self.volume if hasattr(self, "volume") else None)!s}, '
                f'cost_to_move_up_usd={(self.cost_to_move_up_usd if hasattr(self, "cost_to_move_up_usd") else None)!s}, '
                f'cost_to_move_down_usd={(self.cost_to_move_down_usd if hasattr(self, "cost_to_move_down_usd") else None)!s}, '
                f'converted_last={(self.converted_last if hasattr(self, "converted_last") else None)!s}, '
                f'converted_volume={(self.converted_volume if hasattr(self, "converted_volume") else None)!s}, '
                f'trust_score={(self.trust_score if hasattr(self, "trust_score") else None)!s}, '
                f'bid_ask_spread_percentage={(self.bid_ask_spread_percentage if hasattr(self, "bid_ask_spread_percentage") else None)!s}, '
                f'timestamp={(self.timestamp if hasattr(self, "timestamp") else None)!s}, '
                f'last_traded_at={(self.last_traded_at if hasattr(self, "last_traded_at") else None)!s}, '
                f'last_fetch_at={(self.last_fetch_at if hasattr(self, "last_fetch_at") else None)!s}, '
                f'is_anomaly={(self.is_anomaly if hasattr(self, "is_anomaly") else None)!s}, '
                f'is_stale={(self.is_stale if hasattr(self, "is_stale") else None)!s}, '
                f'trade_url={(self.trade_url if hasattr(self, "trade_url") else None)!s}, '
                f'token_info_url={(self.token_info_url if hasattr(self, "token_info_url") else None)!s}, '
                f'coin_id={(self.coin_id if hasattr(self, "coin_id") else None)!s}, '
                f'target_coin_id={(self.target_coin_id if hasattr(self, "target_coin_id") else None)!s})')
