package com.yidianling.uikit.custom.http

import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA_URL
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.yidianling.medical.MedicalFileBeanRespose
import com.yidianling.medical.archives.bean.CreateArchivesResponse
import com.yidianling.medical.archives.bean.GetArchivesResponse
import com.yidianling.medical.archives.bean.MedicalArchivesListBean
import com.yidianling.medical.archives.bean.MedicalUserArchivesBean
import com.yidianling.medical.im.bean.SystemListRespose
import com.yidianling.uikit.custom.http.response.*
import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*
import java.util.*

/**
 * Created by xj on 2019/6/26.
 */
interface ServiceApi {
    //获取专家状态信息
    @GET("chat/status")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun getDoctorChatStatus(@Query("doctorUid") doctorUid: Long): Observable<BaseAPIResponse<ChatStatusBean>>

    //获取专家状态信息
    @GET("chat/assistant-online-status")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun getAssistantChatStatus(@Query("assistantUid") assistantUid: Long): Observable<BaseAPIResponse<Int>>


    //获取推荐专家列表信息
    @GET("doctor/recommendSimilarListeners")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun getRecommendExpertList(
        @Query("doctorUid") doctorUid: Long, @Query("catName") catName: String, @Query(
            "limit"
        ) limit: Int
    ): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>>

    //获取常用语
    @POST("phrase/list")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun getCommonQuestionList(): Observable<BaseAPIResponse<List<CommonQuestionBean>>>

    //常用语的点击
    @GET("phrase/count")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun sendCommonQuestionCount(@Query("id") id: String): Observable<BaseAPIResponse<Any>>


    //信息采集的问题
    @GET("user/collect/list")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun userCollectList(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>>


    //获取新用户收集的信息
    @POST("user/getNewUserMes")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun getNewUserMes(@Body body: RequestBody): Observable<BaseAPIResponse<List<UserQuestInfoBean>>>

    //获取用户来源的信息
    @GET("user/getExChannel")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun getUserSource(@Query("uid") uid: String): Observable<BaseAPIResponse<String>>

    //信息采集的问题
    @POST("user/collect/submit")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun submitUserCollect(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>

    //关注
    @GET("consult/expert-page/toggle-follow")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun focus(
        @Query("doctorId") doctorId: String,
        @Query("status") status: String
    ): Observable<BaseAPIResponse<Any>>

    //服务列表
    @GET("consult/expert-page/nproducts")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun serviceList(@Query("doctorId") doctorId: String): Observable<BaseAPIResponse<List<ServiceItemBean>>>

    //获取输入框的hint内容
    @GET("systemconfig/get-chat-view-config")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun getChatViewConfig(): Observable<BaseAPIResponse<SystemInfoBean>>


    //获取代运营关联的专家的信息
    @GET("chat/get-source-doctor")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)

    //注意：这个接口返回的还有很多字段，但是暂时不需要，就先取这两个字段
    fun getSourceDoctor(
        @Query("scene") scene: Int,
        @Query("userUid") userUid: String,
        @Query("assistantUid") assistantUid: String
    ): Observable<BaseAPIResponse<SourceDoctorInfoBean>>

    //新版前置信息收集 客户端灵犀信息收集卡题库
    @GET("cms/exam/api/v1/exams/lingxi/pre-exam-question-paper")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    //注意：这个接口返回的还有很多字段，但是暂时不需要，就先取这两个字段
    fun preExamQuestionPaper(): Observable<BaseAPIResponse<QuestionsInfoBean>>

    //创建答题信息
    @POST("cms/exam/api/v1/exams")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun createEexams(@Body body: RequestBody): Observable<BaseAPIResponse<String>>

    //答题
    @POST("cms/exam/api/v1/exams/{id}/lingxi/answer-question")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun answerQuestion(
        @Path("id") id: String,
        @Body body: RequestBody
    ): Observable<BaseAPIResponse<String>>

    //医疗获取患者管理列表，支持分页
    @GET("api/client/user/patient/v1/getPageList")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    fun getPageList(
        @Query("pageNum") pageNum: Int,
        @Query("pageSize") pageSize: Int
    ): Observable<BaseAPIResponse<MedicalUserArchivesBean>>

    //医疗   获取问诊人列表
    @GET("api/client/user/patient/v1/getList")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    fun getList(): Observable<BaseAPIResponse<List<MedicalArchivesListBean>>>


    //医疗 创建问诊人
    @POST("api/client/user/patient/v1/create")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    fun createArchives(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>

    //医疗 修改问诊人
    @POST("api/client/user/patient/v1/update")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    fun updateArchives(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>


    //医疗 获取问诊人信息
    @GET("api/client/user/patient/v1/getById")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    fun getArchives( @Query("patientId") patientId: String): Observable<BaseAPIResponse<GetArchivesResponse>>

    //医疗 创建问诊订单
    @POST("api/client/inquiry/v1/create")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    fun createArchivesOrder(@Body body: RequestBody): Observable<BaseAPIResponse<CreateArchivesResponse>>


    //医疗 删除问诊人
    @POST("api/client/user/patient/v1/delete")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    fun deleteArchives(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>


    //上传文件，多文件批量上传
    @POST("api/client/common/v1/uploadBatch")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    @Multipart
    fun uploadBatch(@PartMap params: TreeMap<String, RequestBody>): Observable<BaseAPIResponse<List<MedicalFileBeanRespose>>>


    //上传文件，单文件上传
    @POST("api/client/common/v1/upload")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    fun upload(@PartMap params: TreeMap<String, RequestBody>): Observable<BaseAPIResponse<MedicalFileBeanRespose>>

    //医疗 系统消息列表
    @GET("api/client/message/v1/getPageList")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    fun getSystemPageList(
        @Query("pageNum") pageNum: Int,
        @Query("pageSize") pageSize: Int,
        @Query("read") read: String?
    ): Observable<BaseAPIResponse<SystemListRespose>>

    //医疗 系统消息 设为已读
    @GET("api/client/message/v1/read")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
    fun systemRead(@Query("msgId") msgId: Int): Observable<BaseAPIResponse<Any>>
}