package com.cooleshow.student.api;

import static com.cooleshow.base.common.BaseConstant.AUTH_GROUP;
import static com.cooleshow.base.common.BaseConstant.CMS_SERVER;
import static com.cooleshow.base.common.BaseConstant.MALL_PORTAL_SERVER;
import static com.cooleshow.base.common.BaseConstant.STUDENT_GROUP;
import static com.cooleshow.base.common.BaseConstant.TEACHER_GROUP;

import com.cooleshow.base.data.net.BaseResponse;
import com.cooleshow.student.bean.AddressBean;
import com.cooleshow.student.bean.AppHomeBean;
import com.cooleshow.student.bean.CountOfUnreadBean;
import com.cooleshow.student.bean.CourseTableDataBean;
import com.cooleshow.student.bean.FriendInfoBean;
import com.cooleshow.student.bean.HelpCenterContentBean;
import com.cooleshow.student.bean.HomeLiveAndVideoBean;
import com.cooleshow.student.bean.HomeStyleBean;
import com.cooleshow.student.bean.HomeworkDetailBean;
import com.cooleshow.student.bean.HomeworkListBean;
import com.cooleshow.student.bean.HotAlbumBean;
import com.cooleshow.student.bean.LiveCourseListBean;
import com.cooleshow.student.bean.LiveRoomInfoBean;
import com.cooleshow.student.bean.PayTestBean;
import com.cooleshow.student.bean.PianoRoomCourseHomeworkBean;
import com.cooleshow.student.bean.PianoRoomCourseListBean;
import com.cooleshow.student.bean.PracticeCourseListBean;
import com.cooleshow.student.bean.QuerySubjectBean;
import com.cooleshow.student.bean.SelectMyGroupBean;
import com.cooleshow.student.bean.SparringCourseCommentBean;
import com.cooleshow.student.bean.SparringCourseHomeworkBean;
import com.cooleshow.student.bean.StudentUserInfo;
import com.cooleshow.student.bean.SystemMessageBean;
import com.cooleshow.student.bean.TeachableInstrumentBean;
import com.cooleshow.student.bean.VideoCourseListBean;
import com.cooleshow.usercenter.bean.SetDetailBean;
import com.cooleshow.usercenter.bean.UserInfo;

import java.util.List;
import java.util.Map;

import io.reactivex.rxjava3.core.Observable;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

/**
 * 创建日期：2022/5/26 10:01
 *
 * @author Ryan
 * 类说明：
 */
public interface APIService {
    /**
     * 查询个人信息
     *
     * @param
     * @return
     */
    @GET(AUTH_GROUP + "api/queryUserInfo")
    Observable<BaseResponse<UserInfo>> getUserInfo();

    /**
     * 查询学员基本信息
     *
     * @return
     */
    @GET(STUDENT_GROUP + "student/queryUserInfo")
    Observable<BaseResponse<StudentUserInfo>> queryUserInfo();

    /**
     * 获取设置详情
     *
     * @return
     */
    @GET(AUTH_GROUP + "user/getSetDetail")
    Observable<BaseResponse<SetDetailBean>> getSetDetail();

    /**
     * 修改设置信息
     *
     * @param body
     * @return
     */
    @POST(AUTH_GROUP + "user/submitSetDetail")
    Observable<BaseResponse<SetDetailBean>> submitSetDetail(@Body RequestBody body);

    /**
     * 校验用户手机号和密码
     *
     * @param phone
     * @param password
     * @return
     */
    @GET(AUTH_GROUP + "user/checkUser")
    Observable<BaseResponse<Object>> checkUser(@Query("phone") String phone, @Query("password") String password);

    /**
     * 修改手机号
     *
     * @param authCode
     * @param newPhone
     * @param oldPhone
     * @return
     */
    @POST(AUTH_GROUP + "user/updatePhone")
    Observable<BaseResponse<Object>> updatePhone(@Query("authCode") String authCode, @Query("newPhone") String newPhone, @Query("oldPhone") String oldPhone);

    /**
     * 手机验证码修改密码
     *
     * @return
     */
    @FormUrlEncoded
    @POST(AUTH_GROUP + "user/updatePassword")
    Observable<BaseResponse<Object>> updatePassword(@FieldMap Map<String, String> params);

    /**
     * 发送登录短信验证码
     *
     * @param body mobile 手机号
     *             type:类型（PASSWD:修改密码，LOGIN:登录，REGISTER:注册,BANK:绑定银行卡PHONE:修改手机号））
     * @return
     */
    @FormUrlEncoded
    @POST(STUDENT_GROUP + "code/sendSmsCode")
    Observable<BaseResponse<Object>> sendSmsCode(@FieldMap Map<String, String> params);

    /**
     * 实名认证
     *
     * @param body
     * @return
     */
    @POST(AUTH_GROUP + "user/realNameAuth")
    Observable<BaseResponse<Object>> realNameAuth(@Body RequestBody body);

    /**
     * 测试订单支付
     *
     * @return
     */
    @POST(STUDENT_GROUP + "userOrder/orderPay")
    Observable<BaseResponse<PayTestBean>> orderPay(@Body RequestBody body);

    /**
     * app首页banner、按钮、资讯
     *
     * @return
     */
    @POST(CMS_SERVER + "news/app/home")
    Observable<BaseResponse<AppHomeBean>> appHome(@Body RequestBody body);

    /**
     * 首页热门专辑
     *
     * @param body
     * @return
     */
    @POST(STUDENT_GROUP + "music/album/list")
    Observable<BaseResponse<HotAlbumBean>> hotAlbumList(@Body RequestBody body);

    /**
     * 学生-首页-直播课&视频课&最近课程
     *
     * @param platform
     * @param version
     * @return
     */
    @GET(STUDENT_GROUP + "courseSchedule/queryLiveAndVideo")
    Observable<BaseResponse<HomeLiveAndVideoBean>> queryLiveAndVideo(@Query("platform") String platform, @Query("version") String version);


    /**
     * 首页统计数据
     *
     * @return
     */
    @POST(CMS_SERVER + "helpCenterContent/list")
    Observable<BaseResponse<HelpCenterContentBean>> helpCenterContentList(@Body RequestBody body);


    /**
     * 首页老师风采-分页
     *
     * @param body
     * @return
     */
    @POST(STUDENT_GROUP + "teacher/stylePage")
    Observable<BaseResponse<HomeStyleBean>> getStylePage(@Body RequestBody body);

    /**
     * 我的课程-查询陪练课
     *
     * @param
     * @return
     */
    @POST(STUDENT_GROUP + "courseSchedule/queryStudentPracticeCourse")
    Observable<BaseResponse<PracticeCourseListBean>> queryStudentPracticeCourse(@Body RequestBody body);

    /**
     * 我的课程-查询直播课
     *
     * @param
     * @return
     */
    @POST(STUDENT_GROUP + "courseSchedule/queryStudentLiveCourse")
    Observable<BaseResponse<LiveCourseListBean>> getLiveCourses(@Body RequestBody body);

    /**
     * 我的课程-查询视频课
     *
     * @param
     * @return
     */
    @POST(STUDENT_GROUP + "videoLesson/selectGroup")
    Observable<BaseResponse<VideoCourseListBean>> getVideoCourses(@Body RequestBody body);

    /**
     * 学生端-我的-我的课程-购买的视频课组
     *
     * @param body
     * @return
     */
    @POST(STUDENT_GROUP + "videoLesson/selectMyGroup")
    Observable<BaseResponse<SelectMyGroupBean>> selectMyGroup(@Body RequestBody body);


    /**
     * 获取声部搜索下拉框
     *
     * @return
     */
    @POST(STUDENT_GROUP + "student/querySubjectItem")
    Observable<BaseResponse<List<QuerySubjectBean>>> querySubjectItem();

    /**
     * 课后作业
     *
     * @param body
     * @return
     */
    @POST(STUDENT_GROUP + "homework/list")
    Observable<BaseResponse<HomeworkListBean>> queryHomeworkList(@Body RequestBody body);


    /**
     * 课后作业
     *
     * @param body
     * @return
     */
    @GET(STUDENT_GROUP + "homework/detail/{courseId}")
    Observable<BaseResponse<HomeworkDetailBean>> queryHomeworkDetail(@Path("courseId") String courseId);

    /**
     * 获取所有消息列表
     *
     * @param body
     * @return
     */
    @POST(STUDENT_GROUP + "sysMessage/list")
    Observable<BaseResponse<SystemMessageBean>> sysMessageList(@Body RequestBody body);

    /**
     * 一键已读
     *
     * @return
     */
    @POST(STUDENT_GROUP + "sysMessage/batchSetRead")
    Observable<BaseResponse<Object>> batchSetRead();

    /**
     * 设置已读
     *
     * @return
     */
    @POST(STUDENT_GROUP + "sysMessage/setRead/{id}")
    Observable<BaseResponse<Object>> setCurrentRead(@Path("id") long id);

    /**
     * 查询用户未读消息条数
     *
     * @return
     */
    @GET(STUDENT_GROUP + "sysMessage/queryCountOfUnread")
    Observable<BaseResponse<List<CountOfUnreadBean>>> queryCountOfUnread();

    /**
     * 根据月份获取老师该月有课的日期
     *
     * @param
     * @return
     */
    @POST(STUDENT_GROUP + "courseSchedule/queryCourseScheduleStudent")
    Observable<BaseResponse<List<String>>> getCourseScheduleDateByMonth(@Body RequestBody body);

    /**
     * 根据日期获取老师当日排课
     *
     * @param
     * @return
     */
    @POST(STUDENT_GROUP + "courseSchedule/queryCourseTeacher")
    Observable<BaseResponse<CourseTableDataBean>> getCourseSchedulesWithDate(@Body RequestBody body);

    /**
     * 查询陪练课信息
     *
     * @param
     * @return
     */
    @GET(STUDENT_GROUP + "homework/detail/{courseId}")
    Observable<BaseResponse<SparringCourseHomeworkBean>> getSparringCourseHomework(@Path("courseId") String courseId);

    /**
     * 查询琴房课信息
     *
     * @param
     * @return
     */
    @GET(STUDENT_GROUP + "homework/detail/{courseId}")
    Observable<BaseResponse<PianoRoomCourseHomeworkBean>> getPianoRoomCourseHomework(@Path("courseId") String courseId);

    /**
     * 查询课程评价信息
     *
     * @param
     * @return
     */
    @POST(STUDENT_GROUP + "courseSchedule/selectReplied")
    Observable<BaseResponse<SparringCourseCommentBean>> getSparringCourseComment(@Body RequestBody body);

    /**
     * 提交陪练课评价
     *
     * @param
     * @return
     */
    @POST(STUDENT_GROUP + "courseSchedule/replied")
    Observable<BaseResponse<Object>> submitSparringCourseComment(@Body RequestBody body);

    /**
     * 陪练课-作业提交
     *
     * @param body
     * @return
     */
    @POST(STUDENT_GROUP + "homework/submit")
    Observable<BaseResponse<Object>> submitSparringCourseHomework(@Body RequestBody body);

    /**
     * 提交陪练课老师作业点评
     *
     * @param
     * @return
     */
    @POST(TEACHER_GROUP + "homework/review")
    Observable<BaseResponse<Object>> submitSparringCourseHomeworkComment(@Body RequestBody body);


    /**
     * 乐器列表查询
     *
     * @return
     */
    @GET(STUDENT_GROUP + "subject/subjectSelect")
    Observable<BaseResponse<List<TeachableInstrumentBean>>> subjectSelect();

    /**
     * 根据声部编号查询声部
     *
     * @param id
     * @return
     */
    @GET(STUDENT_GROUP + "subject/get/{id}")
    Observable<BaseResponse<TeachableInstrumentBean>> getSubjectFromId(@Path("id") String id);

    /**
     * 设置声部
     *
     * @param subjectIds
     * @return
     */
    @GET(STUDENT_GROUP + "student/setSubject")
    Observable<BaseResponse<Object>> setSubject(@Query("subjectIds") String subjectIds);

    /**
     * 查询直播房间信息
     *
     * @return
     */
    @GET(STUDENT_GROUP + "liveRoom/studentCheckRoomInfo")
    Observable<BaseResponse<LiveRoomInfoBean>> getLiveRoomInfo(@Query("roomUid") String roomUid);

    /**
     * 通知加入直播房间成功
     *
     * @return
     */
    @GET(STUDENT_GROUP + "liveRoom/joinRoom")
    Observable<BaseResponse<Object>> notifyJoinRoomAction(@Query("roomUid") String roomUid, @Query("userId") String userId);

    /**
     * 通知离开直播房间
     *
     * @return
     */
    @POST(STUDENT_GROUP + "liveRoom/syncUserStatus")
    Observable<BaseResponse<Object>> notifyLeaveRoomAction(@Body RequestBody body);

    /**
     * 查询friend信息
     *
     * @return
     */
    @POST(STUDENT_GROUP + "imUserFriend/getDetail/{userId}")
    Observable<BaseResponse<FriendInfoBean>> queryFriendDetail(@Path("userId") String userId);

    /**
     * 意见反馈
     *
     * @param body
     * @return
     */
    @FormUrlEncoded
    @POST(STUDENT_GROUP + "sysSuggestion/add")
    Observable<BaseResponse<Object>> addSuggestion(@FieldMap Map<String, String> params);

    /**
     * 文件下载
     *
     * @return
     */
    @Streaming
    @GET
    @Headers("User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:0.9.4)")
    Observable<ResponseBody> downloadFileWithFixedUrl(@Url String url);

    /**
     * 查询琴房课列表
     *
     * @param
     * @return
     */
    @POST(STUDENT_GROUP + "courseSchedule/queryPianoClass")
    Observable<BaseResponse<PianoRoomCourseListBean>> getPianoRoomCourseList(@Body RequestBody body);

    /**
     * 校验图片验证码
     * <p>
     * type:类型（PASSWD:修改密码，LOGIN:登录或注册,BANK:绑定银行卡,PHONE:修改手机号）
     *
     * @return
     */
    @FormUrlEncoded
    @POST(TEACHER_GROUP + "code/verifyImageCode")
    Observable<BaseResponse<Object>> verifyImgCode(@FieldMap Map<String, String> map);
}
