package com.yidian.common.http

import com.yidian.common.http.bean.GetCommonConfigBean
import io.reactivex.rxjava3.core.Observable
import retrofit2.Call
import retrofit2.http.*

/**
 * author: yinjiacheng
 * date: 7/8/21 4:53 PM
 * description: Common网络请求定义
 */
interface CommonService {

  companion object {
    // Tower Api域名定义
    const val DOMAIN_TOWER_API_TEST = "http://open-tower-api.test.int.yidian-inc.com:8222"
    const val DOMAIN_TOWER_API_PRO = "https://open-tower-api.go2yd.com"

    // tower-api 获取配置数据
    private const val getCommonConfig = "/api/resource"
  }

  @Headers("Content-Type: application/json")
  @POST(URLs.getKSYunToken)
  fun getKSYunToken(@QueryMap commonParams: Map<String, String>, @Body requestParams: Map<String, String?>): Call<HttpResult<Any?>>

  @GET(URLs.getKSYunObjectId)
  fun getKSYunObjectId(
    @QueryMap commonParams: Map<String, String>,
    @QueryMap requestParams: Map<String, String?>
  ): Observable<HttpResult<Any?>>

  @GET(getCommonConfig)
  fun getCommonConfig(@QueryMap requestParams: Map<String, String>): Observable<HttpResult<GetCommonConfigBean.GetCommonConfigResponse>>
}
