"""
Binance NFT REST API

OpenAPI Specification for the Binance NFT 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 GetNFTAssetResponse
from ..models import GetNFTDepositHistoryResponse
from ..models import GetNFTTransactionHistoryResponse
from ..models import GetNFTWithdrawHistoryResponse


class NFTApi:
    """API Client for NFTApi 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_nft_asset(
        self,
        limit: Optional[int] = None,
        page: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetNFTAssetResponse]:
        """
                Get NFT Asset(USER_DATA)
                GET /sapi/v1/nft/user/getAsset
                https://developers.binance.com/docs/nft/rest-api/Get-NFT-Asset

                Get NFT Asset

        Weight: 3000

                Args:
                    limit (Optional[int] = None): Default 50, Max 50
                    page (Optional[int] = None): Default 1
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetNFTAssetResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

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

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/nft/user/getAsset",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetNFTAssetResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_nft_deposit_history(
        self,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
        page: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetNFTDepositHistoryResponse]:
        """
                Get NFT Deposit History(USER_DATA)
                GET /sapi/v1/nft/history/deposit
                https://developers.binance.com/docs/nft/rest-api/Get-NFT-Deposit-History

                et NFT Deposit History


        * The max interval between startTime and endTime is 90 days.
        * If startTime and endTime are not sent, the recent 7 days' data will be returned.

        Weight: 3000

                Args:
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    limit (Optional[int] = None): Default 50, Max 50
                    page (Optional[int] = None): Default 1
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetNFTDepositHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "start_time": start_time,
            "end_time": end_time,
            "limit": limit,
            "page": page,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/nft/history/deposit",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetNFTDepositHistoryResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_nft_transaction_history(
        self,
        order_type: Union[int, None],
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
        page: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetNFTTransactionHistoryResponse]:
        """
                Get NFT Transaction History(USER_DATA)
                GET /sapi/v1/nft/history/transactions
                https://developers.binance.com/docs/nft/rest-api/Get-NFT-Transaction-History

                Get NFT Transaction History

        * The max interval between startTime and endTime is 90 days.
        * If startTime and endTime are not sent, the recent 7 days' data will be returned.

        Weight: 3000

                Args:
                    order_type (Union[int, None]): 0: purchase order, 1: sell order, 2: royalty income, 3: primary market order, 4: mint fee
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    limit (Optional[int] = None): Default 50, Max 50
                    page (Optional[int] = None): Default 1
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetNFTTransactionHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

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

        body = {}
        payload = {
            "order_type": order_type,
            "start_time": start_time,
            "end_time": end_time,
            "limit": limit,
            "page": page,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/nft/history/transactions",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetNFTTransactionHistoryResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_nft_withdraw_history(
        self,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
        page: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetNFTWithdrawHistoryResponse]:
        """
                Get NFT Withdraw History(USER_DATA)
                GET /sapi/v1/nft/history/withdraw
                https://developers.binance.com/docs/nft/rest-api/Get-NFT-Withdraw-History

                Get NFT Withdraw History

        * The max interval between startTime and endTime is 90 days.
        * If startTime and endTime are not sent, the recent 7 days' data will be returned.

        Weight: 3000

                Args:
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    limit (Optional[int] = None): Default 50, Max 50
                    page (Optional[int] = None): Default 1
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetNFTWithdrawHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "start_time": start_time,
            "end_time": end_time,
            "limit": limit,
            "page": page,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/nft/history/withdraw",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetNFTWithdrawHistoryResponse,
            is_signed=True,
            signer=self._signer,
        )
