# -*- coding: utf-8 -*-

"""
uexcorpapi

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""

from uexcorpapi.api_helper import APIHelper
from uexcorpapi.configuration import Server
from uexcorpapi.http.api_response import ApiResponse
from uexcorpapi.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 uexcorpapi.http.http_method_enum import HttpMethodEnum
from apimatic_core.authentication.multiple.single_auth import Single
from uexcorpapi.models.ok_5 import Ok5
from uexcorpapi.models.ok_6 import Ok6
from uexcorpapi.models.ok_15 import Ok15
from uexcorpapi.models.ok_4 import Ok4
from uexcorpapi.models.ok_18 import Ok18
from uexcorpapi.models.ok_21 import Ok21


class MIdCommodityController(BaseController):

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

    def retrieve_a_list_of_average_prices_and_stock_data_of_a_specific_commodity_in_the_last_15_days_cax_index(self,
                                                                                                               id_commodity,
                                                                                                               accept):
        """Does a GET request to /commodities_averages/id_commodity/{id_commodity}.

        Args:
            id_commodity (str): (Required)
            accept (str): The request header parameter.

        Returns:
            ApiResponse: An object with the response value as well as other
                useful information such as status codes and headers.

        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.SERVER_1)
            .path('/commodities_averages/id_commodity/{id_commodity}')
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                            .key('id_commodity')
                            .value(id_commodity)
                            .is_required(True)
                            .should_encode(True))
            .header_param(Parameter()
                          .key('Accept')
                          .value(accept)
                          .is_required(True))
            .auth(Single('bearer'))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(Ok5.from_dictionary)
            .is_api_response(True)
        ).execute()

    def retrieve_a_list_of_prices_for_all_commodities(self,
                                                      id_commodity,
                                                      accept):
        """Does a GET request to /commodities_prices/id_commodity/{id_commodity}.

        Args:
            id_commodity (str): (Required)
            accept (str): The request header parameter.

        Returns:
            ApiResponse: An object with the response value as well as other
                useful information such as status codes and headers.

        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.SERVER_1)
            .path('/commodities_prices/id_commodity/{id_commodity}')
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                            .key('id_commodity')
                            .value(id_commodity)
                            .is_required(True)
                            .should_encode(True))
            .header_param(Parameter()
                          .key('Accept')
                          .value(accept)
                          .is_required(True))
            .auth(Single('bearer'))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(Ok6.from_dictionary)
            .is_api_response(True)
        ).execute()

    def obtain_a_price_history_of_a_commodity_at_a_specific_location(self,
                                                                     id_terminal,
                                                                     id_commodity,
                                                                     accept):
        """Does a GET request to /commodities_prices_history/id_terminal/{id_terminal}/id_commodity/{id_commodity}.

        Args:
            id_terminal (str): (Required)
            id_commodity (str): (Required)
            accept (str): The request header parameter.

        Returns:
            ApiResponse: An object with the response value as well as other
                useful information such as status codes and headers.

        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.SERVER_1)
            .path('/commodities_prices_history/id_terminal/{id_terminal}/id_commodity/{id_commodity}')
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                            .key('id_terminal')
                            .value(id_terminal)
                            .is_required(True)
                            .should_encode(True))
            .template_param(Parameter()
                            .key('id_commodity')
                            .value(id_commodity)
                            .is_required(True)
                            .should_encode(True))
            .header_param(Parameter()
                          .key('Accept')
                          .value(accept)
                          .is_required(True))
            .auth(Single('bearer'))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(Ok15.from_dictionary)
            .is_api_response(True)
        ).execute()

    def retrieve_a_list_of_average_prices_of_a_specific_commodity_raw_in_the_last_15_days_cax_index(self,
                                                                                                    id_commodity,
                                                                                                    accept):
        """Does a GET request to /commodities_raw_averages/id_commodity/{id_commodity}.

        Args:
            id_commodity (str): (Required)
            accept (str): The request header parameter.

        Returns:
            ApiResponse: An object with the response value as well as other
                useful information such as status codes and headers.

        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.SERVER_1)
            .path('/commodities_raw_averages/id_commodity/{id_commodity}')
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                            .key('id_commodity')
                            .value(id_commodity)
                            .is_required(True)
                            .should_encode(True))
            .header_param(Parameter()
                          .key('Accept')
                          .value(accept)
                          .is_required(True))
            .auth(Single('bearer'))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(Ok4.from_dictionary)
            .is_api_response(True)
        ).execute()

    def retrieve_a_list_of_prices_for_all_unrefined_raw_ore_commodities(self,
                                                                        id_commodity,
                                                                        accept):
        """Does a GET request to /commodities_raw_prices/id_commodity/{id_commodity}.

        Args:
            id_commodity (str): (Required)
            accept (str): The request header parameter.

        Returns:
            ApiResponse: An object with the response value as well as other
                useful information such as status codes and headers.

        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.SERVER_1)
            .path('/commodities_raw_prices/id_commodity/{id_commodity}')
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                            .key('id_commodity')
                            .value(id_commodity)
                            .is_required(True)
                            .should_encode(True))
            .header_param(Parameter()
                          .key('Accept')
                          .value(accept)
                          .is_required(True))
            .auth(Single('bearer'))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(Ok18.from_dictionary)
            .is_api_response(True)
        ).execute()

    def retrieve_a_list_of_common_routes_calculated_based_on_data_reports(self,
                                                                          id_commodity,
                                                                          accept):
        """Does a GET request to /commodities_routes/id_commodity/{id_commodity}.

        Args:
            id_commodity (str): (Required)
            accept (str): The request header parameter.

        Returns:
            ApiResponse: An object with the response value as well as other
                useful information such as status codes and headers.

        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.SERVER_1)
            .path('/commodities_routes/id_commodity/{id_commodity}')
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                            .key('id_commodity')
                            .value(id_commodity)
                            .is_required(True)
                            .should_encode(True))
            .header_param(Parameter()
                          .key('Accept')
                          .value(accept)
                          .is_required(True))
            .auth(Single('bearer'))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(Ok21.from_dictionary)
            .is_api_response(True)
        ).execute()

    def retrieve_a_list_of_all_fuel_prices(self,
                                           id_commodity,
                                           accept):
        """Does a GET request to /fuel_prices/id_commodity/{id_commodity}.

        Args:
            id_commodity (str): (Required)
            accept (str): The request header parameter.

        Returns:
            ApiResponse: An object with the response value as well as other
                useful information such as status codes and headers.

        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.SERVER_1)
            .path('/fuel_prices/id_commodity/{id_commodity}')
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                            .key('id_commodity')
                            .value(id_commodity)
                            .is_required(True)
                            .should_encode(True))
            .header_param(Parameter()
                          .key('Accept')
                          .value(accept)
                          .is_required(True))
            .auth(Single('bearer'))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(Ok4.from_dictionary)
            .is_api_response(True)
        ).execute()
