package com.tenlionsoft.oamodule.net;

import com.tenlionsoft.baselib.core.beans.BaseSuccessBean;
import com.tenlionsoft.oamodule.beans.ByCarRecordBean;
import com.tenlionsoft.oamodule.beans.ByCarRecordListBean;
import com.tenlionsoft.oamodule.beans.CarBean;
import com.tenlionsoft.oamodule.beans.ChoosePersonListBean;
import com.tenlionsoft.oamodule.beans.DepartmentListBean;
import com.tenlionsoft.oamodule.beans.DocTypeBean;
import com.tenlionsoft.oamodule.beans.DocumentDetailBean;
import com.tenlionsoft.oamodule.beans.DocumentListBean;
import com.tenlionsoft.oamodule.beans.DriverBean;
import com.tenlionsoft.oamodule.beans.MeetingRecordListBean;
import com.tenlionsoft.oamodule.beans.MeetingRoomBean;
import com.tenlionsoft.oamodule.beans.MeetingRoomRecordBean;
import com.tenlionsoft.oamodule.beans.MineJoinMeetingListBean;
import com.tenlionsoft.oamodule.beans.RoutineAcceptListBean;
import com.tenlionsoft.oamodule.beans.RoutineBean;
import com.tenlionsoft.oamodule.beans.RoutineListBean;

import java.util.List;

import io.reactivex.rxjava3.core.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * 作者: adam
 * 日期: 2022/4/11 - 2:58 下午
 * 邮箱: itgaojian@163.com
 * 描述:
 */
public interface OAApi {


    /**
     * 获取文档类型列表
     *
     * @return
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/filetype/list")
    Observable<List<DocTypeBean>> getDocTypes(@Header("token") String token);

    /**
     * 结果核查选择人员--获取部门列表
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/department/base/list-byparentid/{parentId}")
    Observable<List<DepartmentListBean>> getDeptListByPid(@Path("parentId") String pId, @Header("token") String token);

    /**
     * 根据部门Id获取部门下所有人员
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/department/user/list/{departmentId}")
    Observable<List<ChoosePersonListBean>> getPersonListByDeptId(@Path("departmentId") String deptId, @Header("token") String token);

    /**
     * 新增文档
     *
     * @param body
     * @return
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @POST("app/fileupload/save")
    Observable<BaseSuccessBean> doSaveFiles(@Body RequestBody body, @Header("token") String token);

    /**
     * 删除文档
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @DELETE("app/fileupload/remove/{ids}")
    Observable<BaseSuccessBean> doDelDoc(@Path("ids") String id, @Header("token") String token);

    /**
     * 编辑文档
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @PUT("app/fileupload/updatefileupload/{fileUploadId}")
    Observable<BaseSuccessBean> doEditDoc(@Path("fileUploadId") String id, @Body RequestBody body, @Header("token") String token);

    /**
     * 获取文档列表
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/fileupload/listpagefileupload")
    Observable<DocumentListBean> getDocumentList(@Query("keywords") String key, @Query("typeBelong") String type, @Query("page") String page, @Header("token") String token);

    /**
     * 获取文档详情
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/fileupload/get/{fileUploadId}")
    Observable<DocumentDetailBean> getDocumentDetail(@Path("fileUploadId") String id, @Header("token") String token);


    /**
     * 获取文档详情
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @POST("app/filerole/save")
    Observable<BaseSuccessBean> doShareDoc(@Body RequestBody body, @Header("token") String token);


    /*=======================用车============================*/

    /**
     * 获取驾驶员列表
     *
     * @return
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/driver/list-select")
    Observable<List<DriverBean>> getDriverList(@Header("token") String token);

    /**
     * 获取车辆列表
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/car/list-select")
    Observable<List<CarBean>> getCarList(@Header("token") String token);

    /**
     * 获取驾驶员排班记录
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/carapply/list-bydriverId/{driverId}/{startTime}/{endTime}")
    Observable<List<ByCarRecordBean>> getDriverRecord(@Path("driverId") String id, @Path("startTime") String start, @Path("endTime") String end, @Header("token") String token);

    /**
     * 获取车辆排班记录
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/carapply/list-bycarid/{carId}/{startTime}/{endTime}")
    Observable<List<ByCarRecordBean>> getByCarRecord(@Path("carId") String id, @Path("startTime") String start, @Path("endTime") String end, @Header("token") String token);


    /**
     * 保存用车申请
     *
     * @param body
     * @return
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @POST("app/carapply/save")
    Observable<BaseSuccessBean> doSaveByCar(@Body RequestBody body, @Header("token") String token);

    /**
     * 获取我的用车申请列表
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/carapply/listpage-me")
    Observable<ByCarRecordListBean> getByCarRecordForMe(@Query("keywords") String key, @Query("page") String page, @Header("token") String token);

    /**
     * 获取我的用车申请详情
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/carapply/get/{carApplyId}")
    Observable<ByCarRecordBean> getByCarRecordDetail(@Path("carApplyId") String page, @Header("token") String token);

    /**
     * 删除用车申请
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @DELETE("app/carapply/remove/{ids}")
    Observable<BaseSuccessBean> doDelByCarRecord(@Path("ids") String id, @Header("token") String token);

    /**
     * 修改用车申请
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @PUT("app/carapply/updatecarapply/{carApplyId}")
    Observable<BaseSuccessBean> doEditByCarRecord(@Path("delayApplyId") String id, @Body RequestBody body, @Header("token") String token);



    /*============================会议===============================*/

    /**
     * 获取会议室选择列表
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/meetingroom/list-select/{roomType}")
    Observable<List<MeetingRoomBean>> getMeetingRoomList(@Path("roomType") String type, @Header("token") String token);

    /**
     * 获取会议室会议记录
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/meeting/list-byroomid/{roomId}/{startTime}/{endTime}")
    Observable<List<MeetingRoomRecordBean>> getMeetingRoomRecordList(@Path("roomId") String id, @Path("startTime") String start, @Path("endTime") String end, @Header("token") String token);

    /**
     * 提交申请会议
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @POST("app/meeting/save")
    Observable<BaseSuccessBean> doSaveMeeting(@Body RequestBody body, @Header("token") String token);

    /**
     * 获取我参加的会议列表
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/meetinguser/listpage-conferee")
    Observable<MineJoinMeetingListBean> getMineJoinMeetingList(@Query("keywords") String key, @Query("page") String page, @Header("token") String token);

    /**
     * 获取我主持的会议列表
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/meetinguser/listpage-host")
    Observable<MineJoinMeetingListBean> getMineEmceeMeetingList(@Query("keywords") String key, @Query("page") String page, @Header("token") String token);

    /**
     * 获取我发起的会议列表
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/meeting/listpage-me")
    Observable<MeetingRecordListBean> getMineApplyMeetingList(@Query("keywords") String key, @Query("page") String page, @Header("token") String token);

    /**
     * 获取会议详情
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/meeting/get/{meetingId}")
    Observable<MeetingRoomRecordBean> getMeetingDetail(@Path("meetingId") String id, @Header("token") String token);

    //========日常工作========

    /**
     * 提交日常工作
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @POST("app/routinework/save")
    Observable<BaseSuccessBean> doSaveRoutine(@Body RequestBody body, @Header("token") String token);

    /**
     * 获取日常工作详情
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/routinework/get/{routineWorkId}")
    Observable<RoutineBean> getRoutineDetail(@Path("routineWorkId") String id, @Header("token") String token);

    /**
     * 获取我发起的日常工作列表
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/routinework/listpage-me")
    Observable<RoutineListBean> getMineRoutineList(@Query("startTime") String start, @Query("endTime") String end, @Query("keywords") String key, @Query("page") String page, @Header("token") String token);

    /**
     * 删除日常工作
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @DELETE("app/routinework/remove/{ids}")
    Observable<BaseSuccessBean> doDelRoutine(@Path("ids") String id, @Header("token") String token);

    /**
     * 获取我接受的日常工作列表
     */
    @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"})
    @GET("app/routineworkuser/listpage-me")
    Observable<RoutineAcceptListBean> getMineAcceptRoutineList(@Query("startTime") String start, @Query("endTime") String end, @Query("keywords") String key, @Query("page") String page, @Header("token") String token);


}
