package com.cheng.bole.net

import com.cheng.bole.net.model.HttpBaseResult
import com.cheng.bole.net.model.HttpListResult
import com.ylqh.cube.bean.CouponActivityEntity
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Part
import retrofit2.http.Query
import retrofit2.http.QueryMap

interface ApiService {

    /**
     * 获取客户端配置
     */
    @GET("/api/user/config")
    suspend fun getUserConfig(
        @Query("oaid") oaid: String,
        @Query("os_version") osVersion: Int,
        @Query("ua") ua: String,
        @Query("imei") imei: String,
        @Query("cid") cid: String,
    ): HttpBaseResult<com.cheng.bole.bean.UserConfigEntity>

    /**
     * 发送验证码
     */
    @POST("/api/user/code")
    suspend fun sendCode(@Body params: Map<String, String>): HttpBaseResult<com.cheng.bole.bean.SendCodeEntity>

    /**
     * 登录
     */
    @POST("/api/user/login")
    suspend fun login(@Body requestBody: RequestBody): HttpBaseResult<com.cheng.bole.bean.LoginEntity>

    /**
     * 退出登录
     */
    @POST("/api/user/logout")
    suspend fun logout(): HttpBaseResult<Any>

    /**
     *更新用户信息
     */
    @PUT("/api/user")
    suspend fun changUser(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 注销
     */
    @POST("/api/user/destroy")
    suspend fun userDestroy(): HttpBaseResult<Any>

    /**
     * 获取用户信息
     */
    @GET("/api/user")
    suspend fun userInfo(): HttpBaseResult<com.cheng.bole.bean.UserEntity>

    /**
     * 获取账号列表
     */
    @GET("/api/user/account")
    suspend fun accountList(@Query("scene") scene: String): HttpBaseResult<List<com.cheng.bole.bean.AccountEntity>>

    /**
     * 上传图片
     */
    @Multipart
    @POST("/api/user/upload")
    suspend fun upload(@Part part: MultipartBody.Part, @Query("scene") scene: String): HttpBaseResult<com.cheng.bole.bean.UploadImgEntity>

    /**
     *删除用户文件
     */
    @DELETE("/api/user/upload")
    suspend fun delUserFile(@Query("id") id: String): HttpBaseResult<Any>

    /**
     * 联系客服
     */
    @GET("/api/weixin/service")
    suspend fun wxService(): HttpBaseResult<com.cheng.bole.bean.WxServiceEntity>

    /**
     * 事件上报
     */
    @POST("/api/user/event")
    suspend fun eventReport(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 推送回执接口
     */
    @PUT("/api/push/receipt")
    suspend fun reportPushReceipt(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 意见反馈
     */
    @POST("/api/user/feedback")
    suspend fun feedback(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 用户公告
     */
    @GET("/api/user/notice")
    suspend fun notice(): HttpBaseResult<com.cheng.bole.bean.NoticeEntity>

    /**
     * 获取VIP套餐列表
     */
    @GET("/api/order/goods")
    suspend fun getGoodsList(@Query("type") type: String = "member"): HttpBaseResult<List<com.cheng.bole.bean.VipGoodsEntity>>

    /**
     * 优惠券列表
     */
    @GET("/api/activity/coupon")
    suspend fun couponList(@QueryMap params: Map<String, String>): HttpBaseResult<HttpListResult<com.cheng.bole.bean.CouponEntity>>

    /**
     * 获取优惠活动列表
     */
    @GET("/api/activity")
    suspend fun couponActivityList(@Query("scene") scene: String): HttpBaseResult<List<CouponActivityEntity>>

    /**
     * 领取活动优惠券
     */
    @POST("/api/activity")
    suspend fun getActivityCoupons(@Query("activity_id") ids: String): HttpBaseResult<Any>

    /**
     * 创建支付订单
     */
    @POST("/api/order")
    suspend fun payCreateOrder(@Body requestBody: RequestBody): HttpBaseResult<com.cheng.bole.bean.OrderPayEntity>

    /**
     * 权限验证
     */
    @GET("/api/user/auth")
    suspend fun checkPermission(@Query("scene") info: String?): HttpBaseResult<com.cheng.bole.bean.VipPermissionEntity>

    /**
     * 权限上报
     */
    @POST("/api/user/auth")
    suspend fun sendCheckPermission(@Body requestBody: RequestBody): HttpBaseResult<Any>
}