package com.gh.gamecenter.feedback.retrofit

import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feedback.entity.HelpCategoryEntity
import com.gh.gamecenter.feedback.entity.HelpEntity
import io.reactivex.Observable
import io.reactivex.Single
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.http.*

interface ApiService {

    /**
     * 获取搜索帮助列表
     */
    @GET("helps/contents")
    fun getSearchHelps(@Query("filter") filter: String?, @Query("page") page: Int): Observable<List<HelpEntity>>

    /**
     * 获取QA内容列表
     */
    @GET("qa/contents")
    fun getQaContents(@Query("filter") filter: String?, @Query("page") page: Int): Observable<List<HelpEntity>>

    /**
     * 获取使用帮助列表
     */
    @GET("helps")
    fun getHelpCategory(): Single<List<HelpCategoryEntity>>

    /**
     * 获取QA相关配置(目前只有是否开启搜索框)
     */
    @GET("qa/{qa_id}")
    fun getQaConfig(@Path("qa_id") qaId: String?): Single<ResponseBody>

    /**
     * 获取QA合集数据
     */
    @GET("qa")
    fun getQaCollection(@Query("collection_id") collectionId: String?): Single<List<HelpCategoryEntity>>

    /**
     * 上传意见反馈
     */
    @Headers("Content-Type: application/json", "Accept: application/json")
    @POST("suggestions")
    fun postSuggestion(@Body body: RequestBody?): Observable<ResponseBody>

    /**
     * 获取意见反馈游戏收录提示数据
     */
    @GET("games")
    fun getSuggestGameCollectHintData(@Query("filter") filter: String?): Observable<List<GameEntity>>

    /**
     * 提交没帮助反馈
     */
    @POST("qa/contents/{content_id}/suggestions")
    fun qaSuggestions(@Path("content_id") contentId: String?, @Body body: RequestBody?): Single<ResponseBody>
}