package com.cooleshow.usercenter.data.api


import com.cooleshow.base.bean.QueryParamsConfigBean
import com.cooleshow.base.common.BaseConstant
import com.cooleshow.base.data.net.BaseResponse
import com.cooleshow.usercenter.bean.UserLoginInfo
import com.cooleshow.usercenter.data.protocol.RegisterReq
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.*


/*
    用户相关 接口
 */
interface UserApi {

    /*
        用户注册
     */
    @POST("userCenter/register")
    fun register(@Body req: RegisterReq): Observable<BaseResponse<String>>

    /*
        用户登录
     */
    @FormUrlEncoded
    @POST(BaseConstant.AUTH_GROUP + "usernameLogin")
    fun login(@FieldMap req: MutableMap<String?, String?>): Observable<BaseResponse<UserLoginInfo>>


    /*
       发送验证码
    */
    @FormUrlEncoded
    @POST(BaseConstant.TEACHER_GROUP + "code/sendSmsCode")
    fun sendSmsCode(
        @Field("mobile") mobile: String,
        @Field("type") type: String
    ): Observable<BaseResponse<Object>>


    /*
      发送验证码
   */
    @FormUrlEncoded
    @POST(BaseConstant.STUDENT_GROUP + "code/sendSmsCode")
    fun sendSmsCodeForStu(
        @Field("mobile") mobile: String,
        @Field("type") type: String
    ): Observable<BaseResponse<Object>>

    /*
          校验验证码
       */
    @FormUrlEncoded
    @POST(BaseConstant.TEACHER_GROUP + "code/verifySmsCode")
    fun checkVerifyCodeValidity(
        @Field("phone") phone: String,
        @Field("code") code: String
    ): Observable<BaseResponse<Object>>


    /*
         校验验证码
      */
    @FormUrlEncoded
    @POST(BaseConstant.STUDENT_GROUP + "code/verifySmsCode")
    fun checkVerifyCodeValidityForStu(
        @Field("phone") phone: String,
        @Field("code") code: String
    ): Observable<BaseResponse<Object>>


    /*
         验证码登录
      */
    @FormUrlEncoded
    @POST(BaseConstant.AUTH_GROUP + "smsLogin")
    fun loginByCode(@FieldMap req: MutableMap<String?, String?>): Observable<BaseResponse<UserLoginInfo>>

    /*
      发送验证码
   */
    @FormUrlEncoded
    @POST(BaseConstant.AUTH_GROUP + "user/setUsernameAndPassword")
    fun bindPassword(
        @Field("password") password: String,
        @Field("username") username: String,
        @Field("gender") gander: String
    ): Observable<BaseResponse<Object>>

    /*
      发送验证码
   */
    @FormUrlEncoded
    @POST(BaseConstant.AUTH_GROUP + "user/setUsernameAndPassword")
    fun bindPassword(@Field("password") password: String): Observable<BaseResponse<Object>>
    /*
        忘记密码
//     */
//    @POST("userCenter/forgetPwd")
//    fun forgetPwd(@Body req:ForgetPwdReq):Observable<BaseResp<String>>
//
//    /*
//        重置密码
//     */
//    @POST("userCenter/resetPwd")
//    fun resetPwd(@Body req:ResetPwdReq):Observable<BaseResp<String>>
//
//    /*
//        编辑用户资料
//     */
//    @POST("userCenter/editUser")
//    fun editUser(@Body req:EditUserReq):Observable<BaseResp<UserInfo>>

    /**
     * 获取修改名称限制时间
     *
     * @param
     * @return
     */
    @GET(BaseConstant.TEACHER_GROUP + "sysConfig/queryByParamName")
    fun queryModifyNickConfigForTeacher(@Query("paramName") last_username_month: String?): Observable<BaseResponse<QueryParamsConfigBean?>?>?


    /**
     * 获取修改名称限制时间
     *
     * @param
     * @return
     */
    @GET(BaseConstant.STUDENT_GROUP + "sysConfig/queryByParamName")
    fun queryModifyNickConfig(@Query("paramName") last_username_month: String?): Observable<BaseResponse<QueryParamsConfigBean?>?>?
}
