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.qy.HomeBannerEntity
import com.zxhl.cms.net.model.qy.*
import com.zxhl.cms.net.model.qy.JgqQyEntity
import com.zxhl.cms.net.model.qy.RightsDetailEntity
import com.zxhl.cms.net.model.qy.TbGoodsEntity
import com.zxhl.cms.net.model.qy.SkillEntity
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_SS_CARD)
    fun epicCardLottery(
        @Query("boxId") boxId: String
    ): Observable<Response<FiveLotteryEntiy>>

    @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_LOTTERY_PROMOTION)
    fun popLottery(
        @Query("boxId") boxId: String,
        @Query("discount") discount: String?,
        @Query("nums") nums: Int
    ): Observable<Response<FiveLotteryEntiy>>

    @POST(NetConfig.Box.HOME_BOX_DUO_CHOU_LOTTERY_CARD)
    fun duoChouLottery(
        @Query("boxId") boxId: String,
        @Query("nums") num: Int
    ): Observable<Response<FiveLotteryEntiy>>

    @POST(NetConfig.Box.HOME_BOX_DUO_SELECT_LOTTERY_CARD)
    fun selectLottery(
        @Query("boxId") boxId: String,
        @Query("nums") num: Int
    ): Observable<Response<FiveLotteryEntiy>>

    @POST(NetConfig.Box.HOME_BOX_LOTTERY_BOX_SELECT)
    fun selectLotteryActivity(
        @Query("boxId") boxId: String,
        @Query("nums") num: 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.Box.HOME_BOX_OPEN_APP)
    fun openApp(): Observable<Response<Any>>

    @POST(NetConfig.Box.HOME_BOX_CLOSE_APP)
    fun closeApp(): Observable<Response<Any>>

    @GET(NetConfig.Box.HOME_BOX_POP_UP)
    fun showPopUp(@Query("type") type: Int): Observable<Response<PopUpEntity>>

    @GET(NetConfig.Box.HOME_BOX_SIGN_LIST)
    fun getSignList(): Observable<Response<SignEntity>>

    @GET(NetConfig.Box.HOME_BOX_SIGN_RECEIVE)
    fun getSignReceive(): Observable<Response<SignReceiveEntity>>

    /**
     * 周内成就列表
     * @return
     */
    @GET(NetConfig.Box.HOME_BOX_WeekAch)
    fun getWeekAchList(): Observable<Response<WeekAchievementEntity?>>

    /**
     * 周内成就领取
     * @return
     */
    @POST(NetConfig.Box.HOME_BOX_WeekAch_RECIVE)
    fun getWeekAchReceive(
        @Query("id") id: String
    ): Observable<Response<WeekAchievementEntity.OpenBoxReward?>>

    /**
     * 注销登录
     * @return
     */
    @GET(NetConfig.Box.HOME_BOX_LOGIN_OUT)
    fun getLoginOut(): Observable<Response<Any?>>

    /**
     * 免费重抽卡领取
     * @return
     */
    @GET(NetConfig.Box.HOME_BOX_GET_FREE_CARD)
    fun getFreeCard(): Observable<Response<Any?>>

    /**
     * 折扣盒子
     * @return
     */
    @GET(NetConfig.Box.HOME_BOX_DISCOUNT_BOX)
    fun getDiscountBox(): Observable<Response<List<HomeBoxListEntity>?>>

    @GET(NetConfig.Box.HOME_BOX_LOTTERY_BOX_RECORD)
    fun getLotteryRecord(
        @Query("boxId") boxId: String
    ): Observable<Response<BoxLotteryRecordEntity>>

    @GET(NetConfig.Box.HOME_BOX_LOTTERY_BOX_RESULT_DETAIL)
    fun getLotteryResultDetail(
        @Query("boxId") boxId: String,
        @Query("characterId") num: String,
        @Query("userId") userId: String
    ): Observable<Response<List<GoodList>>>


    @GET(NetConfig.QY.QY_JGQ_CARD_LIST)
    fun getQyJgqCardList(): Observable<Response<List<JgqQyEntity>>>

    @GET(NetConfig.QY.QY_JGQ_CARD_DETAIL)
    fun getQyJgqCardDetail(
        @Query("brand") brand: String,
        @Query("previewModel") previewModel: String
    ): Observable<Response<List<RightsDetailEntity>>>

    //商品搜索
    @GET(NetConfig.QY.XX_GOODS_SEARCH)
    fun getGoodsListSearch(
        @Query("cate") cate: String,
        @Query("keyword") keyword: String,
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<TbGoodsEntity>>

    //猜你喜欢
    @GET(NetConfig.QY.XX_GOODS_GUESS_LIKE)
    fun getGoodsGuessLike(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<TbGoodsEntity>>

    //转链
    @GET(NetConfig.QY.XX_GOODS_CONVERT_LINK)
    fun getGoodsConvertLink(
        @Query("link") link: String
    ): Observable<Response<ConvertLinkEntity>>

    //图文详情
    @GET(NetConfig.QY.XX_GOODS_ITEM_DETAIL)
    fun getGoodsImgDetail(
        @Query("productId") productId: String
    ): Observable<Response<TbGoodsEntity>>

    //Banner
    @GET(NetConfig.QY.XX_HOME_BANNER)
    fun getHomeBanner(): Observable<Response<List<HomeBannerEntity>>>

    //图文详情
    @GET(NetConfig.FlashSale.HOME_FLASH_SALE_SKILL)
    fun getskill(): Observable<Response<List<SkillEntity>>>

}