package com.zx.ad.modulecommon.net.api

import com.zx.ad.modulecommon.AdNetConfig
import com.zx.ad.modulecommon.module.AdIdConfig
import com.zx.ad.modulecommon.module.NewsEntity
import com.zx.ad.modulecommon.net.Response
import io.reactivex.Observable
import okhttp3.ResponseBody
import retrofit2.http.*

/**
 * Created by gaoleichao on 2020-05-07
 */
interface IAdApi{

    @GET(AdNetConfig.Ad.URL_GET_ADS_V4)
    fun getAds(@Query("slotName") slotId: String): Observable<Response<List<NewsEntity>?>>

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

    /**
     * 普通上报
     *
     * @return
     */
    @POST(AdNetConfig.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?>>

}