"""
Binance Staking REST API

OpenAPI Specification for the Binance Staking 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 ClaimBoostRewardsResponse
from ..models import GetBnsolRateHistoryResponse
from ..models import GetBnsolRewardsHistoryResponse
from ..models import GetBoostRewardsHistoryResponse
from ..models import GetSolRedemptionHistoryResponse
from ..models import GetSolStakingHistoryResponse
from ..models import GetSolStakingQuotaDetailsResponse
from ..models import GetUnclaimedRewardsResponse
from ..models import RedeemSolResponse
from ..models import SolStakingAccountResponse
from ..models import SubscribeSolStakingResponse


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

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

    def claim_boost_rewards(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[ClaimBoostRewardsResponse]:
        """
                Claim Boost Rewards(TRADE)
                POST /sapi/v1/sol-staking/sol/claim
                https://developers.binance.com/docs/staking/sol-staking/staking/Claim-Boost-Rewards

                Claim Boost APR Airdrop Rewards

        * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.

        Weight: 150

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

                Returns:
                    ApiResponse[ClaimBoostRewardsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {"recv_window": recv_window}

        return send_request(
            self._session,
            self._configuration,
            method="POST",
            path="/sapi/v1/sol-staking/sol/claim",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=ClaimBoostRewardsResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_bnsol_rate_history(
        self,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetBnsolRateHistoryResponse]:
        """
                Get BNSOL Rate History(USER_DATA)
                GET /sapi/v1/sol-staking/sol/history/rateHistory
                https://developers.binance.com/docs/staking/sol-staking/history/Get-BNSOL-Rate-History

                Get BNSOL Rate History

        * The time between `startTime` and `endTime` cannot be longer than 3 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

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

                Returns:
                    ApiResponse[GetBnsolRateHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "start_time": start_time,
            "end_time": end_time,
            "current": current,
            "size": size,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/sol-staking/sol/history/rateHistory",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetBnsolRateHistoryResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_bnsol_rewards_history(
        self,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetBnsolRewardsHistoryResponse]:
        """
                Get BNSOL rewards history(USER_DATA)
                GET /sapi/v1/sol-staking/sol/history/bnsolRewardsHistory
                https://developers.binance.com/docs/staking/sol-staking/history/Get-BNSOL-rewards-history

                Get BNSOL rewards history

        * The time between `startTime` and `endTime` cannot be longer than 3 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

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

                Returns:
                    ApiResponse[GetBnsolRewardsHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "start_time": start_time,
            "end_time": end_time,
            "current": current,
            "size": size,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/sol-staking/sol/history/bnsolRewardsHistory",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetBnsolRewardsHistoryResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_boost_rewards_history(
        self,
        type: Union[str, None],
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetBoostRewardsHistoryResponse]:
        """
                Get Boost Rewards History(USER_DATA)
                GET /sapi/v1/sol-staking/sol/history/boostRewardsHistory
                https://developers.binance.com/docs/staking/sol-staking/history/Get-Boost-Rewards-History

                Get Boost rewards history

        * The time between `startTime` and `endTime` cannot be longer than 3 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

                Args:
                    type (Union[str, None]): "CLAIM", "DISTRIBUTE", default "CLAIM"
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Start from 1. Default:1
                    size (Optional[int] = None): Default:10, Max:100
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetBoostRewardsHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

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

        body = {}
        payload = {
            "type": type,
            "start_time": start_time,
            "end_time": end_time,
            "current": current,
            "size": size,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/sol-staking/sol/history/boostRewardsHistory",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetBoostRewardsHistoryResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_sol_redemption_history(
        self,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetSolRedemptionHistoryResponse]:
        """
                Get SOL redemption history(USER_DATA)
                GET /sapi/v1/sol-staking/sol/history/redemptionHistory
                https://developers.binance.com/docs/staking/sol-staking/history/Get-SOL-redemption-history

                Get SOL redemption history

        * The time between `startTime` and `endTime` cannot be longer than 3 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

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

                Returns:
                    ApiResponse[GetSolRedemptionHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "start_time": start_time,
            "end_time": end_time,
            "current": current,
            "size": size,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/sol-staking/sol/history/redemptionHistory",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetSolRedemptionHistoryResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_sol_staking_history(
        self,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetSolStakingHistoryResponse]:
        """
                Get SOL staking history(USER_DATA)
                GET /sapi/v1/sol-staking/sol/history/stakingHistory
                https://developers.binance.com/docs/staking/sol-staking/history/Get-SOL-staking-history

                Get SOL staking history

        * The time between `startTime` and `endTime` cannot be longer than 3 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

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

                Returns:
                    ApiResponse[GetSolStakingHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "start_time": start_time,
            "end_time": end_time,
            "current": current,
            "size": size,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/sol-staking/sol/history/stakingHistory",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetSolStakingHistoryResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_sol_staking_quota_details(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetSolStakingQuotaDetailsResponse]:
        """
                Get SOL staking quota details(USER_DATA)
                GET /sapi/v1/sol-staking/sol/quota
                https://developers.binance.com/docs/staking/sol-staking/account/Get-SOL-staking-quota-details

                Get SOL staking quota

        Weight: 150

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

                Returns:
                    ApiResponse[GetSolStakingQuotaDetailsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {"recv_window": recv_window}

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/sol-staking/sol/quota",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetSolStakingQuotaDetailsResponse,
            is_signed=True,
            signer=self._signer,
        )

    def get_unclaimed_rewards(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetUnclaimedRewardsResponse]:
        """
                Get Unclaimed Rewards(USER_DATA)
                GET /sapi/v1/sol-staking/sol/history/unclaimedRewards
                https://developers.binance.com/docs/staking/sol-staking/history/Get-Unclaimed-Rewards

                Get Unclaimed rewards

        * The time between `startTime` and `endTime` cannot be longer than 3 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

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

                Returns:
                    ApiResponse[GetUnclaimedRewardsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {"recv_window": recv_window}

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/sol-staking/sol/history/unclaimedRewards",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=GetUnclaimedRewardsResponse,
            is_signed=True,
            signer=self._signer,
        )

    def redeem_sol(
        self,
        amount: Union[float, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[RedeemSolResponse]:
        """
                Redeem SOL(TRADE)
                POST /sapi/v1/sol-staking/sol/redeem
                https://developers.binance.com/docs/staking/sol-staking/staking/Redeem-SOL

                Redeem BNSOL get SOL

        * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.

        Weight: 150

                Args:
                    amount (Union[float, None]): Amount in SOL.
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[RedeemSolResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

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

        body = {}
        payload = {"amount": amount, "recv_window": recv_window}

        return send_request(
            self._session,
            self._configuration,
            method="POST",
            path="/sapi/v1/sol-staking/sol/redeem",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=RedeemSolResponse,
            is_signed=True,
            signer=self._signer,
        )

    def sol_staking_account(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[SolStakingAccountResponse]:
        """
                SOL Staking account(USER_DATA)
                GET /sapi/v1/sol-staking/account
                https://developers.binance.com/docs/staking/sol-staking/account/SOL-Staking-account

                SOL Staking account

        Weight: 150

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

                Returns:
                    ApiResponse[SolStakingAccountResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {"recv_window": recv_window}

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/sol-staking/account",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=SolStakingAccountResponse,
            is_signed=True,
            signer=self._signer,
        )

    def subscribe_sol_staking(
        self,
        amount: Union[float, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[SubscribeSolStakingResponse]:
        """
                Subscribe SOL Staking(TRADE)
                POST /sapi/v1/sol-staking/sol/stake
                https://developers.binance.com/docs/staking/sol-staking/staking/Subscribe-SOL-Staking

                Subscribe SOL Staking

        * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.

        Weight: 150

                Args:
                    amount (Union[float, None]): Amount in SOL.
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[SubscribeSolStakingResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

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

        body = {}
        payload = {"amount": amount, "recv_window": recv_window}

        return send_request(
            self._session,
            self._configuration,
            method="POST",
            path="/sapi/v1/sol-staking/sol/stake",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=SubscribeSolStakingResponse,
            is_signed=True,
            signer=self._signer,
        )
