package com.rc.httpcore.client.retrofit;

import com.rc.httpcore.vo.CommonDataResponse;
import com.rc.httpcore.vo.CommonListResponse;
import com.rc.httpcore.vo.CommonResponse;
import com.rc.httpcore.vo.request.AlarmRecordReq;
import com.rc.httpcore.vo.request.ChemicalReq;
import com.rc.httpcore.vo.request.FaceCompareReq;
import com.rc.httpcore.vo.request.LearnLoginReq;
import com.rc.httpcore.vo.request.OperRecordReq;
import com.rc.httpcore.vo.request.OutputStockReq;
import com.rc.httpcore.vo.request.RevertReq;
import com.rc.httpcore.vo.request.TagCodeReq;
import com.rc.httpcore.vo.request.UpdateAlarmRecordReq;
import com.rc.httpcore.vo.request.UpdateRfidReq;
import com.rc.httpcore.vo.request.UseReq;
import com.rc.httpcore.vo.request.UserValidationVo;
import com.rc.httpcore.vo.response.AioAlarmRecordVo;
import com.rc.httpcore.vo.response.AioUserecordVo;
import com.rc.httpcore.vo.response.ApkInfoResp;
import com.rc.httpcore.vo.response.CabinetBean;
import com.rc.httpcore.vo.response.CabinetLockVo;
import com.rc.httpcore.vo.response.ChemicalBean;
import com.rc.httpcore.vo.response.ConfLogo;
import com.rc.httpcore.vo.response.FileRespBean;
import com.rc.httpcore.vo.response.HazardBook;
import com.rc.httpcore.vo.response.LearnLoginVo;
import com.rc.httpcore.vo.response.LockRespBean;
import com.rc.httpcore.vo.response.SubInfoVo;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface ApiService {

    /**
     * 查询LOGO配置列表
     */
    @GET("system/logo/config/getConfInfo")
    Observable<CommonDataResponse<ConfLogo>> queryLogoConfInfo();

    /**
     * 查询APK版本
     */
    @GET("laboratory/apkfile/onepcApkDetail/{id}")
    Observable<CommonDataResponse<ApkInfoResp>> apkVersion(@Path("id") String id);

    /**
     * 上传APK更新状态
     *
     * @param state 0:升级失败; 1:升级成功; 2:升级中
     */
    @PUT("laboratory/apkfile/onepcApkUpdate/{id}/{state}")
    Observable<CommonResponse> onepcApkUpdate(@Path("id") String id, @Path("state") String state);

    /**
     * 用户端登录
     */
    @POST("auth/learn/login")
    Observable<CommonDataResponse<LearnLoginVo>> learnLogin(@Body LearnLoginReq param);

    /**
     * 退出登录
     */
    @POST("auth/learn/loginOut")
    Observable<CommonResponse> loginOut();

    /**
     * 人脸比对
     */
    @POST("{basePath}/faceApi/compare")
    Observable<CommonDataResponse<String>> faceCompare(@Path("basePath") String basePath, @Body FaceCompareReq param);

    /**
     * 查询实验室机柜列表
     */
    @POST("chemical/api/queryCabinetList")
    Observable<CommonDataResponse<List<CabinetBean>>> queryCabinetList(@Body CabinetBean param);

    /**
     * 查询化学品
     */
    @POST("chemical/api/queryChemicalList")
    Observable<CommonListResponse<ChemicalBean>> queryChemicalList(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Body ChemicalReq param);

    /**
     * 查询库存化学品
     */
    @POST("chemical/api/queryChemicalByStock")
    Observable<CommonListResponse<ChemicalBean>> queryChemicalByStock(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Body ChemicalReq param);

    /**
     * 双人验证 刷卡识别身份权限
     */
    @POST("chemical/api/userValidation")
    Observable<CommonDataResponse<UserValidationVo>> userValidation(@Body UserValidationVo param);

    /**
     * 化学品入库
     */
    @POST("chemical/api/addStock")
    Observable<CommonDataResponse<ChemicalBean>> addStock(@Body ChemicalBean param);

    /**
     * 获取危化品安全技术说明书详细信息
     */
    @GET("laboratory/hazard_book/{id}")
    Observable<CommonDataResponse<HazardBook>> hazardBookDetail(@Path("id") String id);

    /**
     * 通过识别卡号或者二维码扫码查询已入库化学品
     */
    @POST("chemical/api/queryByTagCode")
    Observable<CommonDataResponse<ChemicalBean>> queryByTagCode(@Body TagCodeReq param);

    /**
     * 领用化学品
     */
    @POST("chemical/api/addUserecord")
    Observable<CommonResponse> addUserecord(@Body UseReq param);

    /**
     * 归还时查询已领用化学品
     */
    @POST("chemical/api/queryByUserecord")
    Observable<CommonDataResponse<ChemicalBean>> queryByUserecord(@Body TagCodeReq param);

    /**
     * 归还化学品
     */
    @POST("chemical/api/updateUserecord")
    Observable<CommonResponse> updateUserecord(@Body RevertReq param);

    /**
     * 化学品出库
     */
    @POST("chemical/api/outStock")
    Observable<CommonResponse> outStock(@Body OutputStockReq param);

    /**
     * RFID 标签更换
     */
    @POST("chemical/api/updateStock")
    Observable<CommonResponse> updateStock(@Body UpdateRfidReq param);

    /**
     * 查询使用记录
     */
    @POST("chemical/api/queryRecordList")
    Observable<CommonListResponse<AioUserecordVo>> queryRecordList(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Body OperRecordReq param);

    /**
     * 查询报警记录列表
     */
    @POST("chemical/api/queryAlarmRecordList")
    Observable<CommonListResponse<AioAlarmRecordVo>> queryAlarmRecordList(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Body AlarmRecordReq param);

    /**
     * 查询报警记录详情
     */
    @GET("chemical/api/queryAlarmRecordDetail")
    Observable<CommonDataResponse<AioAlarmRecordVo>> queryAlarmRecordDetail(@Query("id") String id);

    /**
     * 检测类型报警记录手动处理
     */
    @POST("chemical/api/updateAlarmRecord")
    Observable<CommonResponse> updateAlarmRecord(@Body UpdateAlarmRecordReq param);

    /**
     * 判断当前登录人是否管理员
     */
    @POST("chemical/api/authValidation")
    Observable<CommonDataResponse<Boolean>> authValidation();

    /**
     * 终端登录查询实验室信息
     */
    @POST("chemical/api/querySubInfo")
    Observable<CommonDataResponse<SubInfoVo>> querySubInfo();

    /**
     * 人脸身份验证
     */
    @POST("chemical/api/faceAuth")
    Observable<CommonDataResponse<UserValidationVo>> faceAuth(@Body SubInfoVo param);

    /**
     * 查询机柜柜锁列表
     */
    @POST("chemical/api/queryCabinetLockList")
    Observable<CommonDataResponse<List<CabinetLockVo>>> queryCabinetLockList(@Body CabinetLockVo param);

    /**
     * 柜锁开锁
     */
    @POST("chemical/api/openLock")
    Observable<CommonDataResponse<LockRespBean>> openLock(@Body CabinetLockVo param);

    /**
     * 柜锁关锁
     */
    @POST("chemical/api/closeLock")
    Observable<CommonDataResponse<LockRespBean>> closeLock(@Body CabinetLockVo param);

    /**
     * 上传文件
     */
    @Multipart
    @POST("{basePath}file/upload")
    @Headers("Transfer-Encoding: chunked")
    Observable<CommonDataResponse<FileRespBean>> fileUpload(@Path(value = "basePath", encoded = true) String basePath, @Part MultipartBody.Part filePart);

}
