# -*- 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.derivatives_tickers_list import DerivativesTickersList


class DerivativesExchangesID(object):

    """Implementation of the 'DerivativesExchangesID' model.

    Attributes:
        name (str): derivatives exchange name
        open_interest_btc (float): derivatives exchange open interest in BTC
        trade_volume_24_h_btc (str): derivatives exchange trade volume in BTC
            in 24 hours
        number_of_perpetual_pairs (float): number of perpetual pairs in the
            derivatives exchange
        number_of_futures_pairs (float): number of futures pairs in the
            derivatives exchange
        image (str): derivatives exchange image url
        year_established (float): derivatives exchange established year
        country (str): derivatives exchange incorporated country
        description (str): derivatives exchange description
        url (str): derivatives exchange website url
        tickers (List[DerivativesTickersList]): The model property of type
            List[DerivativesTickersList].

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": 'name',
        "open_interest_btc": 'open_interest_btc',
        "trade_volume_24_h_btc": 'trade_volume_24h_btc',
        "number_of_perpetual_pairs": 'number_of_perpetual_pairs',
        "number_of_futures_pairs": 'number_of_futures_pairs',
        "image": 'image',
        "year_established": 'year_established',
        "country": 'country',
        "description": 'description',
        "url": 'url',
        "tickers": 'tickers'
    }

    _optionals = [
        'name',
        'open_interest_btc',
        'trade_volume_24_h_btc',
        'number_of_perpetual_pairs',
        'number_of_futures_pairs',
        'image',
        'year_established',
        'country',
        'description',
        'url',
        'tickers',
    ]

    _nullables = [
        'year_established',
        'country',
    ]

    def __init__(self,
                 name=APIHelper.SKIP,
                 open_interest_btc=APIHelper.SKIP,
                 trade_volume_24_h_btc=APIHelper.SKIP,
                 number_of_perpetual_pairs=APIHelper.SKIP,
                 number_of_futures_pairs=APIHelper.SKIP,
                 image=APIHelper.SKIP,
                 year_established=APIHelper.SKIP,
                 country=APIHelper.SKIP,
                 description=APIHelper.SKIP,
                 url=APIHelper.SKIP,
                 tickers=APIHelper.SKIP):
        """Constructor for the DerivativesExchangesID class"""

        # Initialize members of the class
        if name is not APIHelper.SKIP:
            self.name = name 
        if open_interest_btc is not APIHelper.SKIP:
            self.open_interest_btc = open_interest_btc 
        if trade_volume_24_h_btc is not APIHelper.SKIP:
            self.trade_volume_24_h_btc = trade_volume_24_h_btc 
        if number_of_perpetual_pairs is not APIHelper.SKIP:
            self.number_of_perpetual_pairs = number_of_perpetual_pairs 
        if number_of_futures_pairs is not APIHelper.SKIP:
            self.number_of_futures_pairs = number_of_futures_pairs 
        if image is not APIHelper.SKIP:
            self.image = image 
        if year_established is not APIHelper.SKIP:
            self.year_established = year_established 
        if country is not APIHelper.SKIP:
            self.country = country 
        if description is not APIHelper.SKIP:
            self.description = description 
        if url is not APIHelper.SKIP:
            self.url = url 
        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
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        open_interest_btc = dictionary.get("open_interest_btc") if dictionary.get("open_interest_btc") else APIHelper.SKIP
        trade_volume_24_h_btc = dictionary.get("trade_volume_24h_btc") if dictionary.get("trade_volume_24h_btc") else APIHelper.SKIP
        number_of_perpetual_pairs = dictionary.get("number_of_perpetual_pairs") if dictionary.get("number_of_perpetual_pairs") else APIHelper.SKIP
        number_of_futures_pairs = dictionary.get("number_of_futures_pairs") if dictionary.get("number_of_futures_pairs") else APIHelper.SKIP
        image = dictionary.get("image") if dictionary.get("image") else APIHelper.SKIP
        year_established = dictionary.get("year_established") if "year_established" in dictionary.keys() else APIHelper.SKIP
        country = dictionary.get("country") if "country" in dictionary.keys() else APIHelper.SKIP
        description = dictionary.get("description") if dictionary.get("description") else APIHelper.SKIP
        url = dictionary.get("url") if dictionary.get("url") else APIHelper.SKIP
        tickers = None
        if dictionary.get('tickers') is not None:
            tickers = [DerivativesTickersList.from_dictionary(x) for x in dictionary.get('tickers')]
        else:
            tickers = APIHelper.SKIP
        # Return an object of this model
        return cls(name,
                   open_interest_btc,
                   trade_volume_24_h_btc,
                   number_of_perpetual_pairs,
                   number_of_futures_pairs,
                   image,
                   year_established,
                   country,
                   description,
                   url,
                   tickers)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'name={(self.name if hasattr(self, "name") else None)!r}, '
                f'open_interest_btc={(self.open_interest_btc if hasattr(self, "open_interest_btc") else None)!r}, '
                f'trade_volume_24_h_btc={(self.trade_volume_24_h_btc if hasattr(self, "trade_volume_24_h_btc") else None)!r}, '
                f'number_of_perpetual_pairs={(self.number_of_perpetual_pairs if hasattr(self, "number_of_perpetual_pairs") else None)!r}, '
                f'number_of_futures_pairs={(self.number_of_futures_pairs if hasattr(self, "number_of_futures_pairs") else None)!r}, '
                f'image={(self.image if hasattr(self, "image") else None)!r}, '
                f'year_established={(self.year_established if hasattr(self, "year_established") else None)!r}, '
                f'country={(self.country if hasattr(self, "country") else None)!r}, '
                f'description={(self.description if hasattr(self, "description") else None)!r}, '
                f'url={(self.url if hasattr(self, "url") else None)!r}, '
                f'tickers={(self.tickers if hasattr(self, "tickers") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'name={(self.name if hasattr(self, "name") else None)!s}, '
                f'open_interest_btc={(self.open_interest_btc if hasattr(self, "open_interest_btc") else None)!s}, '
                f'trade_volume_24_h_btc={(self.trade_volume_24_h_btc if hasattr(self, "trade_volume_24_h_btc") else None)!s}, '
                f'number_of_perpetual_pairs={(self.number_of_perpetual_pairs if hasattr(self, "number_of_perpetual_pairs") else None)!s}, '
                f'number_of_futures_pairs={(self.number_of_futures_pairs if hasattr(self, "number_of_futures_pairs") else None)!s}, '
                f'image={(self.image if hasattr(self, "image") else None)!s}, '
                f'year_established={(self.year_established if hasattr(self, "year_established") else None)!s}, '
                f'country={(self.country if hasattr(self, "country") else None)!s}, '
                f'description={(self.description if hasattr(self, "description") else None)!s}, '
                f'url={(self.url if hasattr(self, "url") else None)!s}, '
                f'tickers={(self.tickers if hasattr(self, "tickers") else None)!s})')
