package com.common.commonlibtest.manager

import com.common.commonlib.net.BaseObserve
import com.common.commonlib.net.callback.RequestCallBack
import com.common.commonlibtest.bean.LoginResponse
import io.reactivex.rxjava3.core.Observable
import okhttp3.Interceptor
import retrofit2.http.*

class LoginLoader(interceptors: List<Interceptor>) :
    BaseObserve<LoginLoader.LoginApi>(LoginApi::class.java, interceptors) {

    fun login(userName: String, pwd: String, callBack: RequestCallBack<LoginResponse>) {
        observe(api.login(userName, pwd), callBack)
    }

    interface LoginApi {
        @FormUrlEncoded
        @Headers("baseurl:debug1")
        @POST("/user/login")
        fun login(
            @Field("username") userName: String,
            @Field("password") pwd: String
        ): Observable<LoginResponse>
    }
}