package com.module.pay.service

import com.quyunshuo.wanandroid.common.bean.BaseResponse
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.FieldMap
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.QueryMap
import retrofit2.http.Url
import java.util.TreeMap

/**
 * Home模块的接口
 *
 * @author Qu Yunshuo
 * @since 6/4/21 5:51 PM
 */
interface HomeApiService {

    /**
     * 请求密码
     */
    @GET("/SZWL-SERVER/api/app_equipment/index/getPwd.htm")
    suspend fun getPwd(@QueryMap params: Map<String, String>): BaseResponse<String>

    /**
     * 二码合一
     */
    @GET("/PAY-SERVER/tOrder/twoPayCode")
    suspend fun twoPayCode(@QueryMap params: Map<String, String>): String

    /**
     * 二码合一支付Api 购物车
     */
    @POST()
    suspend fun carsPay(@Url url:String,@Body body: RequestBody): String


    // 零售上报
/*    @POST("/f/retail")
    @Headers("Content-Type:application/json")
    fun retail(
        @Header("Authorization") apiKey: String?,
        @Body requestBody: RequestBody?
    ): Response<Unit>*/
    @POST("ORDER-SERVER/tCoinOrder/saveCoinOrder")
    suspend fun uploadOrder(@Body requestBody: RequestBody): Response<Unit>
    /**
     * 初始化设备
     */
    @POST("/SZWL-SERVER/api/app_equipment/index/initNew.htm")
    suspend fun initDev(@QueryMap params: Map<String, String>): String

    /**
     * 检查更新
     */
    @GET("/SZWL-SERVER/api/appApkInfo/apkinfo.htm")
    suspend fun apkinfo(@QueryMap params: Map<String, String>): String

    /**
     * 获取这台设备的广告规则  [242,1440,1439] 视频id.
     */
    @GET("/SZWL-SERVER/api/app_ADIndex/ADIndex/getTimeRule.htm")
    suspend fun getVideoRule(@QueryMap params: Map<String, Long>): String


    /**
     * 根据广告规则id获取对应的广告视频信息
     */
    @GET("/SZWL-SERVER/api/app_ADIndex/ADIndex/getAdById.htm")
    suspend fun getVideoInfo(@QueryMap params: Map<String, String>): String

    /**
     * 订单查询
     */
    @GET("/PAY-SERVER/tCoinOrder/newFindCoinOrder")
    suspend fun newFindCoinOrder(@QueryMap params: MutableMap<String, Any>): String

    /**
     * 添加mq通道
     */
    @GET("/SZWL-SERVER/api/app_mq/rabbitMq/addQueue.htm")
    suspend fun addQueue(@QueryMap params: MutableMap<String, Any>): String

    /**
     * 修改通道
     */
    @GET("/SZWL-SERVER/api/app_mq/rabbitMq/updateChannel.htm")
    suspend fun updateChannel(@QueryMap params: Map<String, String>): String


    /**
     * 请求闹钟
     */
    @GET("/SZWL-SERVER/api/app_alarmClock/alarmClockIndex/getClock.htm")
    suspend fun getClock(@QueryMap params: Map<String, String>): String


    /**
     *  修改优惠码状态 为已使用
     */
    @GET("/SZWL-SERVER/tPromoCode/updateCode")
    suspend fun updateCode(@QueryMap params: Map<String, String>): String


    @POST("/2.0/device/detail")
    @Headers("Content-Type:application/x-www-form-urlencoded;charset=utf-8")
    suspend fun getData(@QueryMap paramTreeMap: TreeMap<String, String>): String


    //上传开关机状态new
    @FormUrlEncoded
    @POST("/SZWL-SERVER/api/app_equipment/index/updateEqeStatusNew.htm")
    suspend  fun updateEqeStatusNew(@FieldMap params: Map<String, Any>): String


    //更新做糖状态
    @GET("/SZWL-SERVER/api/SugarDo/updateSugarDoStatus.htm")
    fun updateSugarDoStatus(@QueryMap params: Map<String, Any>): String
}