"""
Binance Copy Trading REST API

OpenAPI Specification for the Binance Copy Trading 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.
"""

import requests
from typing import Optional, TypeVar
from binance_common.configuration import ConfigurationRestAPI
from binance_common.models import ApiResponse
from binance_common.signature import Signers
from binance_common.utils import send_request
from .api.future_copy_trading_api import FutureCopyTradingApi

from .models import GetFuturesLeadTraderStatusResponse
from .models import GetFuturesLeadTradingSymbolWhitelistResponse


T = TypeVar("T")


class CopyTradingRestAPI:
    def __init__(
        self,
        configuration: ConfigurationRestAPI,
    ) -> None:
        self.configuration = configuration
        self._session = requests.Session()
        self._signer = (
            Signers.get_signer(
                configuration.private_key, configuration.private_key_passphrase
            )
            if configuration.private_key is not None
            else None
        )

        self._futureCopyTradingApi = FutureCopyTradingApi(
            self.configuration, self._session, self._signer
        )

    def send_request(
        self,
        endpoint: str,
        method: str,
        query_params: Optional[dict] = None,
        body_params: Optional[dict] = None,
    ) -> ApiResponse[T]:
        """
        Sends an request to the Binance REST API.

        Args:
            endpoint (str): The API endpoint path to send the request to.
            method (str): The HTTP method to use for the request (e.g. "GET", "POST", "PUT", "DELETE").
            query_params (Optional[dict]): The request payload as a dictionary, or None if no payload is required.
            body_params (Optional[dict]): The request body as a dictionary, or None if no body is required.

        Returns:
            ApiResponse[T]: The API response, where T is the expected response type.
        """
        return send_request[T](
            self._session,
            self.configuration,
            method,
            endpoint,
            query_params,
            body_params,
        )

    def send_signed_request(
        self,
        endpoint: str,
        method: str,
        query_params: Optional[dict] = None,
        body_params: Optional[dict] = None,
    ) -> ApiResponse[T]:
        """
        Sends a signed request to the Binance REST API.

        Args:
            endpoint (str): The API endpoint path to send the request to.
            method (str): The HTTP method to use for the request (e.g. "GET", "POST", "PUT", "DELETE").
            query_params (Optional[dict]): The request payload as a dictionary, or None if no payload is required.
            body_params (Optional[dict]): The request body as a dictionary, or None if no body is required.

        Returns:
            ApiResponse[T]: The API response, where T is the expected response type.
        """
        return send_request[T](
            self._session,
            self.configuration,
            method,
            endpoint,
            query_params,
            body_params,
            is_signed=True,
            signer=self._signer,
        )

    def get_futures_lead_trader_status(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFuturesLeadTraderStatusResponse]:
        """
                Get Futures Lead Trader Status(TRADE)

                Get Futures Lead Trader Status
        Weight: 20

                Args:
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetFuturesLeadTraderStatusResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._futureCopyTradingApi.get_futures_lead_trader_status(recv_window)

    def get_futures_lead_trading_symbol_whitelist(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFuturesLeadTradingSymbolWhitelistResponse]:
        """
                Get Futures Lead Trading Symbol Whitelist(USER_DATA)

                Get Futures Lead Trading Symbol Whitelist
        Weight: 20

                Args:
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetFuturesLeadTradingSymbolWhitelistResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._futureCopyTradingApi.get_futures_lead_trading_symbol_whitelist(
            recv_window
        )
