package com.ym.modulecommon.net

import com.ym.modulecommon.module.AdIdConfig
import com.ym.modulecommon.module.NewsEntity
import com.ym.modulecommon.module.WithdrawResultEntity
import com.ym.modulecommon.news.entity.AdNewsHomeEntity
import com.ym.modulecommon.news.entity.AdNewsInfomationEntity
import com.ym.modulecommon.news.entity.AdNewsWebEntity
import io.reactivex.Observable
import okhttp3.ResponseBody
import retrofit2.http.*

interface ZXAdApi {


    @GET(NetConfig.Ad.URL_GET_ADS_V3)
    fun getAd(@Query("slotName") slotId: String): Observable<Response<List<NewsEntity>>>

    @GET("v1/fetch/adAppIds")
    fun getADConfig(@Query("pkg") pkg: String): Observable<Response<List<AdIdConfig>?>>

    /**
     * 普通上报
     *
     * @return
     */
    @POST(NetConfig.Ad.URL_EVENT)
    fun requestEvent(
        @Query("module") module: String?,
        @Body data: Any?
    ): Observable<Response<Any?>>

    /**
     * 广告上报
     *
     * @return
     */
    @GET
    fun requestEvent(@Url url: String?): Observable<Response<ResponseBody?>>

    /**
     * 新闻赚首页
     */
    @GET(NetConfig.Ad.URL_NEWS_HOME)
    fun getNewsHomeData(): Observable<Response<AdNewsHomeEntity?>>

    /**
     * 新闻赚首页提现
     */
    @POST(NetConfig.Ad.URL_NEWS_GET_REWARD)
    fun getReward(): Observable<Response<WithdrawResultEntity?>>

    /**
     * 修改资讯状态
     */
    @GET(NetConfig.Ad.URL_NEWS_STATUS)
    fun getNewsStatus(
        @Query("newsId") newsId: Int,
        @Query("type") type: Int
    ): Observable<Response<AdNewsWebEntity?>>

    /**
     * 获取资讯状态
     */
    @GET(NetConfig.Ad.URL_NEWS_UPDATEPROGRESS)
    fun getNewsUpdateProgress(
        @Query("newsId") newsId: Int,
        @Query("type") type: Int,
        @Query("url") url: String
    ): Observable<Response<AdNewsWebEntity?>>


    /**
     * 获取资讯状态
     */
    @GET(NetConfig.Ad.URL_NEWS_UPDATEPROGRESS)
    fun getNewsUpdateProgress(
        @Query("newsId") newsId: Int,
        @Query("type") type: Int,
        @Query("url") url: String,
        @Query("adv") adv: Int
    ): Observable<Response<AdNewsWebEntity?>>

    /**
     * 获取资讯状态
     */
    @GET(NetConfig.Ad.URL_NEWS_INFO)
    fun getInfomation(): Observable<Response<AdNewsInfomationEntity?>>

}