package com.cheng.blzb.net

import com.cheng.blzb.bean.AccountEntity
import com.cheng.blzb.bean.AreaEntity
import com.cheng.blzb.bean.BidDetailEntity
import com.cheng.blzb.bean.BidItemEntity
import com.cheng.blzb.bean.BidTypeEntity
import com.cheng.blzb.bean.CompanyEntity
import com.cheng.blzb.bean.CorpEntity
import com.cheng.blzb.bean.CouponEntity
import com.cheng.blzb.bean.GuideTotalBidEntity
import com.cheng.blzb.bean.GuideUpdateEntity
import com.cheng.blzb.bean.HotWordEntity
import com.cheng.blzb.bean.LoginEntity
import com.cheng.blzb.bean.MerchantGoodsEntity
import com.cheng.blzb.bean.OrderEntity
import com.cheng.blzb.bean.OrderPayEntity
import com.cheng.blzb.bean.ZZDBInfoEntity
import com.cheng.blzb.bean.SeatItemEntity
import com.cheng.blzb.bean.SendCodeEntity
import com.cheng.blzb.bean.SourceEntity
import com.cheng.blzb.bean.SubscriptionEntity
import com.cheng.blzb.bean.SubscriptionMessageEntity
import com.cheng.blzb.bean.UploadFileEntity
import com.cheng.blzb.bean.UserAuthEntity
import com.cheng.blzb.bean.UserConfigEntity
import com.cheng.blzb.bean.UserEntity
import com.cheng.blzb.bean.VipGoodsEntity
import com.cheng.blzb.bean.WxServiceEntity
import com.cheng.blzb.net.model.HttpBaseResult
import com.cheng.blzb.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.Path
import retrofit2.http.Query
import retrofit2.http.QueryMap

interface ApiService {
    /**
     * 获取服务器时间
     */
    @GET("/api/time")
    suspend fun getServerTime(): HttpBaseResult<String>

    /**
     * 获取客户端配置
     */
    @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<UserConfigEntity>

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

    /**
     * 登录
     */
    @POST("/api/user/login")
    suspend fun login(@Body requestBody: RequestBody): HttpBaseResult<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<UserEntity>

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

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

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

    /**
     * 联系客服
     */
    @GET("/api/weixin/service")
    suspend fun wxService(): HttpBaseResult<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>

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

    /**
     * 优惠券列表
     */
    @GET("/api/activity/coupon")
    suspend fun couponList(@QueryMap params: Map<String, String>): HttpBaseResult<HttpListResult<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<OrderPayEntity>

    /**
     * 订单列表查询
     */
    @GET("/api/order")
    suspend fun getOrderList(@Query("status") status: String): HttpBaseResult<List<OrderEntity>>

    /**
     * 订单查询
     */
    @GET("/api/order")
    suspend fun getOrderInfo(@Query("order_id") orderId: String): HttpBaseResult<OrderEntity>

    /**
     * 更新订单
     */
    @PUT("/api/order")
    suspend fun updateOrder(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 权限验证
     */
    @GET("/api/user/auth")
    suspend fun checkAuth(@Query("scene") scene: String? = "info"): HttpBaseResult<UserAuthEntity>

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

    /**
     * 引导页推荐热词树
     */
    @GET("/api/hot_word")
    suspend fun getHotWordList(): HttpBaseResult<List<HotWordEntity>>

    /**
     * 城市列表
     */
    @GET("/api/city")
    suspend fun getAreaList(): HttpBaseResult<List<AreaEntity>>

    /**
     * 获取当前城市
     */
    @GET("/api/city/default")
    suspend fun getUserCity(): HttpBaseResult<AreaEntity>

    /**
     * 总计商机
     */
    @GET("/api/search/preview")
    suspend fun getTotalBidInfo(
        @Query("keyword") keywords: String,
        @Query("city_id") cityIds: String,
        @Query("second_kind_num") kindCount: String
    ): HttpBaseResult<GuideTotalBidEntity>

    /**
     * 每日更新
     */
    @GET("/api/info/update/num")
    suspend fun getUpdateNum(@Query("size") size: String): HttpBaseResult<List<GuideUpdateEntity>>

    /**
     * 会员页轮播提示
     */
    @GET("/api/pay/tips")
    suspend fun getPayUserTips(): HttpBaseResult<List<String>>

    /**
     * 订阅列表
     */
    @GET("/api/recommend/subscription")
    suspend fun getSubscriptionList(): HttpBaseResult<HttpListResult<SubscriptionEntity>>

    /**
     * 订阅推荐列表
     */
    @GET("/api/recommend")
    suspend fun getRecommendList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidItemEntity>>

    /**
     * 添加订阅
     */
    @POST("/api/recommend/subscription")
    suspend fun addSubscription(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 修改订阅
     */
    @PUT("/api/recommend/subscription")
    suspend fun updateSubscription(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 删除订阅
     */
    @DELETE("/api/recommend/subscription")
    suspend fun deleteSubscription(@Query("id") id: String): HttpBaseResult<Any>

    /**
     * 招标公告类型
     */
    @GET("/api/info/type")
    suspend fun getBidTypeList(): HttpBaseResult<List<BidTypeEntity>>

    /**
     * 标讯详情
     *
     * source：search 搜索 | recommend 首页 | push 推送| favorite 关注列表| history 历史记录
     */
    @GET("/api/info/json")
    suspend fun getBidDetail(
        @Query("id") id: String,
        @Query("source") source: String,
        @Query("info_source") infoSource: String
    ): HttpBaseResult<BidDetailEntity>

    /**
     * 收藏列表
     */
    @GET("/api/info/favorite/search")
    suspend fun getFavoriteList(): HttpBaseResult<HttpListResult<BidItemEntity>>

    /**
     * 收藏标讯
     */
    @POST("/api/info/favorite")
    suspend fun favorite(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 取消收藏标讯
     */
    @DELETE("/api/info/favorite")
    suspend fun favoriteCancel(@Query("infoId") id: String): HttpBaseResult<Any>

    /**
     * 热词推荐
     */
    @GET("/api/search/words")
    suspend fun getHotKeywords(@QueryMap map: Map<String, String>): HttpBaseResult<List<String>>

    /**
     * 热门数据源
     */
    @GET("/api/source/hot")
    suspend fun getHotSources(): HttpBaseResult<HttpListResult<SourceEntity>>

    /**
     * 搜索数据源
     */
    @GET("/api/source/search")
    suspend fun searchSource(@Query("keyword") keyword: String, @Query("size") size: String = "10"): HttpBaseResult<HttpListResult<SourceEntity>>

    /**
     * 搜索页最新标讯和本地标讯
     */
    @GET("/api/info/ks/search")
    suspend fun getNewestLocalBidList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidItemEntity>>

    /**
     * 项目搜索
     */
    @GET("/api/search")
    suspend fun search(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidItemEntity>>

    /**
     * 供应商搜索
     */
    @GET("/api/user/goods/searchks")
    suspend fun searchGoods(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<MerchantGoodsEntity>>

    /**
     * 浏览历史
     */
    @GET("/api/info/history")
    suspend fun getViewHistoryList(): HttpBaseResult<HttpListResult<BidDetailEntity>>

    /**
     * 添加代办
     */
    @POST("/api/agency/clew")
    suspend fun addAgency(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 资质代办列表
     */
    @GET("/api/agency/cert")
    suspend fun getAgencyList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<ZZDBInfoEntity>>

    /**
     * 我的标讯列表
     */
    @GET("/api/user/info")
    suspend fun getMyBidList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidDetailEntity>>

    /**
     * 查询标讯
     */
    @GET("/api/user/info/{id}")
    suspend fun getBidInfo(@Path("id") id: String): HttpBaseResult<BidItemEntity>

    /**
     * 添加标讯
     */
    @POST("/api/user/info")
    suspend fun addBidInfo(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 修改标讯
     */
    @PUT("/api/user/info")
    suspend fun updateBidInfo(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 删除标讯
     */
    @DELETE("/api/user/info/{id}")
    suspend fun deleteBidInfo(@Path("id") id: String): HttpBaseResult<Any>

    /**
     * 我的商品列表
     */
    @GET("/api/user/goods")
    suspend fun getMyGoodsList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<MerchantGoodsEntity>>

    /**
     * 查询商品
     */
    @GET("/api/user/goods/{id}")
    suspend fun getGoodsInfo(@Path("id") id: String): HttpBaseResult<MerchantGoodsEntity>

    /**
     * 添加商品
     */
    @POST("/api/user/goods")
    suspend fun addGoodsInfo(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 修改商品
     */
    @PUT("/api/user/goods")
    suspend fun updateGoodsInfo(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 删除商品
     */
    @DELETE("/api/user/goods/{id}")
    suspend fun deleteGoodsInfo(@Path("id") id: String): HttpBaseResult<Any>

    /**
     * 获取用户公司信息
     */
    @GET("/api/user/company")
    suspend fun getCompanyInfo(): HttpBaseResult<CompanyEntity>

    /**
     * 提交用户公司信息
     */
    @POST("/api/user/company")
    suspend fun addCompanyInfo(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 修改用户公司信息
     */
    @PUT("/api/user/company")
    suspend fun updateCompanyInfo(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 席位信息
     */
    @GET("/api/corp")
    suspend fun getSeatInfo(): HttpBaseResult<CorpEntity>

    /**
     * 席位列表
     */
    @GET("/api/corp/user")
    suspend fun getSeatList(@Query("page") page: String = "1", @Query("size") size: String = "100"): HttpBaseResult<HttpListResult<SeatItemEntity>>

    /**
     * 添加席位
     */
    @POST("/api/corp/user")
    suspend fun addSeat(@Body requestBody: RequestBody): HttpBaseResult<Any>

    /**
     * 删除席位
     */
    @DELETE("/api/corp/user")
    suspend fun deleteSeat(@Query("id") id: String): HttpBaseResult<Any>

    /**
     * 订阅消息列表
     */
    @GET("/api/message/ks")
    suspend fun getSubscriptionMessage(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<SubscriptionMessageEntity>>
}