package com.remax.visualnovel.api.service

import com.remax.visualnovel.BuildConfig
import com.remax.visualnovel.entity.request.ChargeOrderDTO
import com.remax.visualnovel.entity.request.ChargeProductDTO
import com.remax.visualnovel.entity.request.ChargeProductInfo
import com.remax.visualnovel.entity.request.SearchPage
import com.remax.visualnovel.entity.request.SubPriceDTO
import com.remax.visualnovel.entity.request.ValidateTransactionDTO
import com.remax.visualnovel.entity.response.ChargeOrder
import com.remax.visualnovel.entity.response.Membership
import com.remax.visualnovel.entity.response.SubPrice
import com.remax.visualnovel.entity.response.Transaction
import com.remax.visualnovel.entity.response.UserSubInfo
import com.remax.visualnovel.entity.response.Wallet
import com.remax.visualnovel.entity.response.base.Response
import retrofit2.http.Body
import retrofit2.http.POST

interface PayService {
    /**
     * 获取我的流水
     */
    @POST(BuildConfig.API_LION + "/web/pay/account/bill-list")
    suspend fun getTransactionList(@Body request: SearchPage): Response<Transaction>

    /**
     * 获取我的钱包
     */
    @POST(BuildConfig.API_LION + "/web/pay/account/wallet")
    suspend fun getMyWallet(): Response<Wallet>

    /**
     * 获取充值产品
     */
    @POST(BuildConfig.API_LION + "/web/pay/config/charge-product-list")
    suspend fun getChargeProducts(
        @Body dto: ChargeProductDTO = ChargeProductDTO()
    ): Response<ChargeProductInfo>


    /**
     * 获取vip订阅价格列表
     */
    @POST(BuildConfig.API_LION + "/web/pay/config/sub-product-list")
    suspend fun getSubPriceList(
        @Body subPriceDTO: SubPriceDTO = SubPriceDTO()
    ): Response<List<SubPrice>>

    /**
     * 会员特权列表
     */
    @POST(BuildConfig.API_LION + "/web/member/detail")
    suspend fun getVipPrivilegeList(): Response<Membership>

    /**
     * 创建一个订单
     */
    @POST(BuildConfig.API_LION +"/web/pay/trade/pre-charge-google")
    suspend fun createOrder(
        @Body dto: ChargeOrderDTO
    ): Response<ChargeOrder>

    /**
     * 验证支付是否成功
     */
    @POST(BuildConfig.API_LION +"/web/pay/webhooks/google/v2")
    suspend fun validateTranslation(
        @Body dto: ValidateTransactionDTO
    ): Response<Any>

    /**
     * 验证订阅是否成功
     */
    @POST(BuildConfig.API_LION +"/web/pay/subscribe/upload-google-receipt")
    suspend fun uploadGoogleReceipt(
        @Body dto: ValidateTransactionDTO
    ): Response<String>

    /**
     * 订阅/升级VIP前查询订阅信息
     */
    @POST(BuildConfig.API_LION +"/web/pay/appStore/getUserSubscription")
    suspend fun checkSubInfo(): Response<UserSubInfo>


}