"""
Binance Dual Investment REST API

OpenAPI Specification for the Binance Dual Investment REST API
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""

from typing import Optional, Union
from requests import Session
from binance_common.configuration import ConfigurationRestAPI
from binance_common.errors import RequiredError
from binance_common.models import ApiResponse
from binance_common.signature import Signers
from binance_common.utils import send_request

from ..models import GetDualInvestmentProductListResponse


class MarketDataApi:
    """API Client for MarketDataApi endpoints."""

    def __init__(
        self,
        configuration: ConfigurationRestAPI = None,
        session: Session = None,
        signer: Signers = None,
    ) -> None:
        self._configuration = configuration
        self._session = session
        self._signer = signer

    def get_dual_investment_product_list(
        self,
        option_type: Union[str, None],
        exercised_coin: Union[str, None],
        invest_coin: Union[str, None],
        page_size: Optional[int] = None,
        page_index: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetDualInvestmentProductListResponse]:
        """
                Get Dual Investment product list
                GET /sapi/v1/dci/product/list
                https://developers.binance.com/docs/dual_investment/market-data/Get-Dual-Investment-product-list

                Get Dual Investment product list

        Weight: 1(IP)

                Args:
                    option_type (Union[str, None]): Input CALL or PUT
                    exercised_coin (Union[str, None]): Target exercised asset, e.g.: if you subscribe to a high sell product (call option), you should input: `optionType`:CALL,`exercisedCoin`:USDT,`investCoin`:BNB; if you subscribe to a low buy product (put option), you should input: `optionType`:PUT,`exercisedCoin`:BNB,`investCoin`:USDT
                    invest_coin (Union[str, None]): Asset used for subscribing, e.g.: if you subscribe to a high sell product (call option), you should input: `optionType`:CALL,`exercisedCoin`:USDT,`investCoin`:BNB; if you subscribe to a low buy product (put option), you should input: `optionType`:PUT,`exercisedCoin`:BNB,`investCoin`:USDT
                    page_size (Optional[int] = None): Default: 10, Maximum: 100
                    page_index (Optional[int] = None): Default: 1
                    recv_window (Optional[int] = None): The value cannot be greater than 60000

                Returns:
                    ApiResponse[GetDualInvestmentProductListResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        if option_type is None:
            raise RequiredError(
                field="option_type",
                error_message="Missing required parameter 'option_type'",
            )
        if exercised_coin is None:
            raise RequiredError(
                field="exercised_coin",
                error_message="Missing required parameter 'exercised_coin'",
            )
        if invest_coin is None:
            raise RequiredError(
                field="invest_coin",
                error_message="Missing required parameter 'invest_coin'",
            )

        body = {}
        payload = {
            "option_type": option_type,
            "exercised_coin": exercised_coin,
            "invest_coin": invest_coin,
            "page_size": page_size,
            "page_index": page_index,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/dci/product/list",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetDualInvestmentProductListResponse,
            is_signed=True,
            signer=self._signer,
        )
