# -*- 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.configuration import Server
from coingeckopublicapiv3.controllers.base_controller import BaseController
from apimatic_core.request_builder import RequestBuilder
from apimatic_core.response_handler import ResponseHandler
from apimatic_core.types.parameter import Parameter
from coingeckopublicapiv3.http.http_method_enum import HttpMethodEnum
from apimatic_core.authentication.multiple.single_auth import Single
from apimatic_core.authentication.multiple.or_auth_group import Or
from coingeckopublicapiv3.models.simple_price import SimplePrice
from coingeckopublicapiv3.models.simple_token_price import SimpleTokenPrice


class SimpleController(BaseController):

    """A Controller to access Endpoints in the coingeckopublicapiv3 API."""
    def __init__(self, config):
        super(SimpleController, self).__init__(config)

    def simple_price(self,
                     vs_currencies,
                     ids=None,
                     names=None,
                     symbols=None,
                     include_tokens=None,
                     include_market_cap=None,
                     include_24_hr_vol=None,
                     include_24_hr_change=None,
                     include_last_updated_at=None,
                     precision=None):
        """Does a GET request to /simple/price.

        This endpoint allows you to **query the prices of one or more coins by
        using their unique Coin API IDs**

        Args:
            vs_currencies (str): target currency of coins, comma-separated if
                querying more than 1 currency. <br> *refers to
                [`/simple/supported_vs_currencies`](/reference/simple-supported
                -currencies).
            ids (str, optional): coins' IDs, comma-separated if querying more
                than 1 coin. <br> *refers to
                [`/coins/list`](/reference/coins-list).
            names (str, optional): coins' names, comma-separated if querying
                more than 1 coin.
            symbols (str, optional): coins' symbols, comma-separated if
                querying more than 1 coin.
            include_tokens (IncludeTokensEnum, optional): for `symbols`
                lookups, specify `all` to include all matching tokens <br>
                Default `top` returns top-ranked tokens (by market cap or
                volume)
            include_market_cap (bool, optional): include market
                capitalization, default: false
            include_24_hr_vol (bool, optional): include 24hr volume, default:
                false
            include_24_hr_change (bool, optional): include 24hr change,
                default: false
            include_last_updated_at (bool, optional): include last updated
                price time in UNIX, default: false
            precision (PrecisionEnum, optional): decimal place for currency
                price value

        Returns:
            SimplePrice: Response from the API. price(s) of cryptocurrency

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path('/simple/price')
            .http_method(HttpMethodEnum.GET)
            .query_param(Parameter()
                         .key('vs_currencies')
                         .value(vs_currencies))
            .query_param(Parameter()
                         .key('ids')
                         .value(ids))
            .query_param(Parameter()
                         .key('names')
                         .value(names))
            .query_param(Parameter()
                         .key('symbols')
                         .value(symbols))
            .query_param(Parameter()
                         .key('include_tokens')
                         .value(include_tokens))
            .query_param(Parameter()
                         .key('include_market_cap')
                         .value(include_market_cap))
            .query_param(Parameter()
                         .key('include_24hr_vol')
                         .value(include_24_hr_vol))
            .query_param(Parameter()
                         .key('include_24hr_change')
                         .value(include_24_hr_change))
            .query_param(Parameter()
                         .key('include_last_updated_at')
                         .value(include_last_updated_at))
            .query_param(Parameter()
                         .key('precision')
                         .value(precision))
            .header_param(Parameter()
                          .key('accept')
                          .value('application/json'))
            .auth(Or(Single('apiKeyAuth'), Single('apiKeyQueryParam')))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(SimplePrice.from_dictionary)
        ).execute()

    def simple_token_price(self,
                           id,
                           contract_addresses,
                           vs_currencies,
                           include_market_cap=None,
                           include_24_hr_vol=None,
                           include_24_hr_change=None,
                           include_last_updated_at=None,
                           precision=None):
        """Does a GET request to /simple/token_price/{id}.

        This endpoint allows you to **query one or more token prices using
        their token contract addresses**

        Args:
            id (str): asset platform's ID <br> *refers to
                [`/asset_platforms`](/reference/asset-platforms-list).
            contract_addresses (str): the contract address of a token
            vs_currencies (str): target currency of coins, comma-separated if
                querying more than 1 currency. <br> *refers to
                [`/simple/supported_vs_currencies`](/reference/simple-supported
                -currencies).
            include_market_cap (bool, optional): include market
                capitalization, default: false
            include_24_hr_vol (bool, optional): include 24hr volume, default:
                false
            include_24_hr_change (bool, optional): include 24hr change <br>
                default: false
            include_last_updated_at (bool, optional): include last updated
                price time in UNIX , default: false
            precision (PrecisionEnum, optional): decimal place for currency
                price value

        Returns:
            SimpleTokenPrice: Response from the API. price(s) of cryptocurrency

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path('/simple/token_price/{id}')
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                            .key('id')
                            .value(id)
                            .should_encode(True))
            .query_param(Parameter()
                         .key('contract_addresses')
                         .value(contract_addresses))
            .query_param(Parameter()
                         .key('vs_currencies')
                         .value(vs_currencies))
            .query_param(Parameter()
                         .key('include_market_cap')
                         .value(include_market_cap))
            .query_param(Parameter()
                         .key('include_24hr_vol')
                         .value(include_24_hr_vol))
            .query_param(Parameter()
                         .key('include_24hr_change')
                         .value(include_24_hr_change))
            .query_param(Parameter()
                         .key('include_last_updated_at')
                         .value(include_last_updated_at))
            .query_param(Parameter()
                         .key('precision')
                         .value(precision))
            .header_param(Parameter()
                          .key('accept')
                          .value('application/json'))
            .auth(Or(Single('apiKeyAuth'), Single('apiKeyQueryParam')))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(SimpleTokenPrice.from_dictionary)
        ).execute()

    def simple_supported_currencies(self):
        """Does a GET request to /simple/supported_vs_currencies.

        This endpoint allows you to **query all the supported currencies on
        CoinGecko**

        Returns:
            List[str]: Response from the API. list of supported currencies

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path('/simple/supported_vs_currencies')
            .http_method(HttpMethodEnum.GET)
            .header_param(Parameter()
                          .key('accept')
                          .value('application/json'))
            .auth(Or(Single('apiKeyAuth'), Single('apiKeyQueryParam')))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
        ).execute()
