package com.zxhl.cms.net.api

import com.zxhl.cms.ad.upload.model.Response
import com.zxhl.cms.common.NetConfig
import com.zxhl.cms.net.model.box.*
import com.zxhl.cms.net.model.other.IsWeChatLoginEntity
import com.zxhl.cms.net.model.other.WxBindEntity
import com.zxhl.cms.net.model.uc.UserInfo
import com.zxhl.cms.net.model.uc.VersionEntity
import io.reactivex.Observable
import retrofit2.http.*


interface IHomeApi {

    @GET(NetConfig.Box.HOME_BOX_LIST)
    fun getHomelist(
        @Query("page") page: Int,
        @Query("size") size: Int,
        @Query("category") category: String
    ): Observable<Response<List<HomeBoxListEntity>>>

    @GET(NetConfig.Box.HOME_BOX_NEW_PEOPLE)
    fun getNewPeopleBox(
    ): Observable<Response<HomeBoxListEntity>>

    @GET(NetConfig.Box.HOME_BOX_NEW_PEOPLE_29)
    fun getNewPeopleBox29(
    ): Observable<Response<HomeBoxListEntity>>

    @GET(NetConfig.Box.HOME_BOX_NEW_PEOPLE_24)
    fun getNewPeopleBox24(
    ): Observable<Response<HomeBoxListEntity>>

    @GET(NetConfig.Box.HOME_BOX_INFO)
    fun getBoxInfo(
        @Query("boxId") boxId: String
    ): Observable<Response<BoxInfoEntity>>

    @GET(NetConfig.Box.HOME_BOX_MARQUEE)
    fun getBoxMarquee(
        @Query("boxId") boxId: String,
        @Query("num") num: Int
    ): Observable<Response<List<MarqueeEntity>>>

    @GET(NetConfig.Box.HOME_BOX_GOODS)
    fun getBoxGoods(
        @Query("boxId") boxId: String
    ): Observable<Response<GoodsPoolEntity>>

    @GET(NetConfig.Box.HOME_BOX_DEPOT)
    fun getDepot(
        @Query("page") page: Int,
        @Query("size") size: Int,
        @Query("status") status: Int,
        @Query("type") type: Int,
    ): Observable<Response<List<DepotEntity>>>

    @POST(NetConfig.Box.HOME_BOX_LOTTERY_CARD)
    fun oneLottery(
        @Query("boxId") boxId: String
    ): Observable<Response<OneLotteryEntity>>

    @POST(NetConfig.Box.HOME_BOX_FIVE_LOTTERY_CARD)
    fun fiveLottery(
        @Query("boxId") boxId: String
    ): Observable<Response<FiveLotteryEntiy>>

    @POST(NetConfig.Box.HOME_BOX_CARD_RE_PUMPING)
    fun rePumpingOneLottery(
        @Query("boxId") boxId: String,
        @Query("depotIds") depotIds: String
    ): Observable<Response<OneLotteryEntity>>

    @POST(NetConfig.Box.HOME_BOX_CARD_RE_PUMPING_FIVE)
    fun rePumpingFiveLottery(
        @Query("boxId") boxId: String,
        @Query("depotIds") depotIds: String
    ): Observable<Response<FiveLotteryEntiy>>

    @POST(NetConfig.Box.HOME_BOX_LOTTERY_TEST)
    fun testLottery(
        @Query("boxId") boxId: String
    ): Observable<Response<LotteryEntity>>

    @GET(NetConfig.Box.HOME_BOX_GET_ADDRESS)
    fun getAddress(
        @Query("isDefault") isDefault: String
    ): Observable<Response<List<AddressEntity>>>

    @POST(NetConfig.Box.HOME_BOX_DEL_ADDRESS)
    fun delAddress(
        @Body entity: AddressEntity?
    ): Observable<Response<Any>>

    @POST(NetConfig.Box.HOME_BOX_EDIT_ADDRESS)
    fun editAddress(
        @Body entity: AddressEntity?
    ): Observable<Response<Any>>

    @POST(NetConfig.Box.HOME_BOX_RECOVER)
    fun recoverGoods(
        @Query("depotIds") depotIds: String,
        @Query("recoverType") recoverType: String
    ): Observable<Response<Any>>


    @GET(NetConfig.Box.HOME_BOX_SHIPPING)
    fun getShipping(
        @Query("depotIds") depotIds: String,
        @Query("addressId") addressId: String?
    ): Observable<Response<OrderEntity>>

    @GET(NetConfig.Box.HOME_BOX_SHOP_COST)
    fun getshopCost(
        @Query("goodIds") goodIds: String,
        @Query("addressId") addressId: String?
    ): Observable<Response<OrderEntity>>

    @POST(NetConfig.Box.HOME_BOX_CREATE_SHAOPPING_ORDER)
    fun createOrder(
        @Query("addressId") addressId: String?,
        @Query("depotIds") depotIds: String?,
        @Query("orderNotes") orderNotes: String?,
        @Query("outTradeNo") outTradeNo: String?
    ): Observable<Response<Any>>

    @POST(NetConfig.Box.HOME_BOX_SHOP_BUY_ONLY)
    fun shopBuyOnly(
        @Query("addressId") addressId: String?,
        @Query("goodIds") goodIds: String?,
        @Query("orderNotes") orderNotes: String?
    ): Observable<Response<Any>>

    @GET(NetConfig.Box.HOME_BOX_VERIFICATION)
    fun getVerfication(
    ): Observable<Response<VerifacationEntity>>

    //判断用户是否微信登录
    @GET(NetConfig.User.USER_IS_WX_LOGIN)
    fun isWxLogin(): Observable<Response<IsWeChatLoginEntity>>

    //绑定微信
    @POST(NetConfig.User.AUTH_WX_LOGIN)
    fun bindWx(
        @Query("openid") oppenid: String,
        @Query("accessToken") token: String
    ): Observable<Response<WxBindEntity>>

    @POST(NetConfig.Box.HOME_BOX_GOODS_PICK_UP)
    fun pickUpGoods(
        @Query("depotId") depotId: String,
        @Query("mobile") mobile: String
    ): Observable<Response<Any>>

    @GET(NetConfig.Box.HOME_BOX_CANCE_CHOOSE)
    fun canceChoose(
        @Query("boxId") boxId: String
    ): Observable<Response<Any>>

    @GET(NetConfig.Box.HOME_BOX_TAB)
    fun getBoxTab(): Observable<Response<List<TabEntity>>>

    @GET(NetConfig.Box.HOME_BOX_APP_INFO)
    fun getAppInfo(): Observable<Response<AppInEntity>>

    @GET(NetConfig.Box.HOME_BOX_POPUPS)
    fun getPopups(): Observable<Response<PopupsEntity>>

    /**
     * 获取验证码
     *
     * @return
     */
    @POST(NetConfig.User.USER_SEND_CODE)
    fun requestCode(@Query("phoneNo") phone: String): Observable<Response<Any>>

    /**
     * 验证码登录
     *
     * @return
     */
    @POST(NetConfig.User.USER_PHONE_CODE_LOGIN)
    fun requestCodeLogin(
        @Query("phoneNo") phone: String,
        @Query("code") code: String
    ): Observable<Response<UserInfo>>

    @GET(NetConfig.User.URL_VERSION)
    fun getVersion(): Observable<Response<VersionEntity?>>

    @POST(NetConfig.Box.HOME_BOX_FEED_BACK)
    fun feedBack(
        @Query("content") content: String,
        @Query("contact") contact: String
    ): Observable<Response<Any>>


    /**
     * 盲盒道具卡片列表
     * @return
     */
    @GET(NetConfig.Box.HOME_BOX_PROP_CARD_LIST)
    fun getPropsCardList(
        @Query("boxId") boxId: String
    ): Observable<Response<PropsCardList?>>

    @GET(NetConfig.Box.HOME_BOX_CASH_LOG)
    fun getMagicCoinLog(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<List<MagicCoinLogEntity>?>>

    @GET(NetConfig.Box.HOME_BOX_ORDER_SHOP)
    fun getBoxOrderShop(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<List<ShopOrderEntity>?>>

    @GET(NetConfig.Box.HOME_BOX_ORDER)
    fun getOrder(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<List<ShopOrderEntity>?>>

    @GET(NetConfig.Box.HOME_BOX_INFO_BOXLIST)
    fun getInfoBoxList(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<List<HomeBoxListEntity>?>>

    @GET(NetConfig.Box.HOME_BOX_NOTICE)
    fun getNotice(): Observable<Response<NoticeEntity?>>

    @POST(NetConfig.User.URL_AUTH_GOOGLE_LOGIN)
    fun authGoogleLogin(
        @Query("userID") userID: String?,
        @Query("nickname") nickname: String?,
        @Query("picture") picture: String?
    ): Observable<Response<WxBindEntity?>>
}