"""
Binance VIP Loan REST API

OpenAPI Specification for the Binance VIP Loan 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
from requests import Session
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 ..models import CheckVIPLoanCollateralAccountResponse
from ..models import GetVIPLoanOngoingOrdersResponse
from ..models import QueryApplicationStatusResponse


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

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

    def check_vip_loan_collateral_account(
        self,
        order_id: Optional[int] = None,
        collateral_account_id: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[CheckVIPLoanCollateralAccountResponse]:
        """
                Check VIP Loan Collateral Account (USER_DATA)
                GET /sapi/v1/loan/vip/collateral/account
                https://developers.binance.com/docs/vip_loan/user-information/Check-Locked-Value-of-VIP-Collateral-Account

                VIP loan is available for VIP users only

        * If the login account is loan account, all collateral accounts under the loan account can be queried.
        * If the login account is collateral account, only the current collateral account can be queried.

        Weight: 6000

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

                Returns:
                    ApiResponse[CheckVIPLoanCollateralAccountResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "order_id": order_id,
            "collateral_account_id": collateral_account_id,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/loan/vip/collateral/account",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=CheckVIPLoanCollateralAccountResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_vip_loan_ongoing_orders(
        self,
        order_id: Optional[int] = None,
        collateral_account_id: Optional[int] = None,
        loan_coin: Optional[str] = None,
        collateral_coin: Optional[str] = None,
        current: Optional[int] = None,
        limit: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetVIPLoanOngoingOrdersResponse]:
        """
                Get VIP Loan Ongoing Orders(USER_DATA)
                GET /sapi/v1/loan/vip/ongoing/orders
                https://developers.binance.com/docs/vip_loan/user-information/Get-VIP-Loan-Ongoing-Orders

                VIP loan is available for VIP users only.

        Weight: 400

                Args:
                    order_id (Optional[int] = None):
                    collateral_account_id (Optional[int] = None):
                    loan_coin (Optional[str] = None):
                    collateral_coin (Optional[str] = None):
                    current (Optional[int] = None): Currently querying page. Start from 1, Default:1, Max: 1000.
                    limit (Optional[int] = None): Default: 10, Max: 100
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetVIPLoanOngoingOrdersResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "order_id": order_id,
            "collateral_account_id": collateral_account_id,
            "loan_coin": loan_coin,
            "collateral_coin": collateral_coin,
            "current": current,
            "limit": limit,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/loan/vip/ongoing/orders",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetVIPLoanOngoingOrdersResponse,
            is_signed=True,
            signer=self._signer,
        )

    def query_application_status(
        self,
        current: Optional[int] = None,
        limit: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryApplicationStatusResponse]:
        """
                Query Application Status(USER_DATA)
                GET /sapi/v1/loan/vip/request/data
                https://developers.binance.com/docs/vip_loan/user-information/Query-Application-Status

                Query Application Status

        Weight: 400

                Args:
                    current (Optional[int] = None): Currently querying page. Start from 1, Default:1, Max: 1000.
                    limit (Optional[int] = None): Default: 10, Max: 100
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[QueryApplicationStatusResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {"current": current, "limit": limit, "recv_window": recv_window}

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/loan/vip/request/data",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=QueryApplicationStatusResponse,
            is_signed=True,
            signer=self._signer,
        )
