package com.dahe.gldriver.net

import com.dahe.gldriver.BuildConfig
import com.dahe.gldriver.bean.AuthTeamBean
import com.dahe.gldriver.bean.OcrPersonBean
import com.dahe.gldriver.bean.OrderDetailBean
import com.dahe.gldriver.bean.OssBean
import com.dahe.gldriver.bean.UpBankInfoBean
import com.dahe.gldriver.bean.UpDriverInfoBean
import com.dahe.gldriver.bean.UpPersonInfoBean
import com.dahe.gldriver.bean.UpPicBean
import com.dahe.gldriver.bean.UpQualiInfoBean
import com.dahe.glex.bean.*
import com.dahe.mylibrary.net.CommonResponseBean
import io.reactivex.rxjava3.core.Observable
import okhttp3.MultipartBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Query


/**
 * Created by Administrator on 2024/01/8 0008.
 */
interface Api {
    /*-------------------登录----------------------------*/
    @POST(BASE_URL + "common/register")
    fun log(@Body logBean: LogBean?): Observable<CommonResponseBean<UserBean>>

    @GET(BASE_URL + "auth/driver/login")
    fun login(
        @Query("contactPhone") contactPhone: String,
        @Query("code") code: String
    ): Observable<CommonResponseBean<UserBean>>


    /**
     * 获取验证码
     * */
    @GET(BASE_URL + "auth/driver/code")
    fun getCode(@Query("contactPhone") contactPhone: String): Observable<CommonResponseBean<UserBean>>

    /**
     * 上传到oss
     * */
    @Multipart
    @POST(BASE_URL + "file/uploadToOss")
    fun uploadToOss(
        @Part file: MultipartBody.Part
    ): Observable<CommonResponseBean<OssBean>>

    /**
     * 个人身份证识别
     * */
    @GET(BASE_URL + "ocr/aliyunOcr/recognizeIdcard")
    fun recognizeIdcard(
        @Query("imgUrl") imgUrl: String
    ): Observable<CommonResponseBean<OcrPersonBean>>

    /**
     * 驾驶证识别
     * */
    @GET(BASE_URL + "ocr/aliyunOcr/recognizeDrivingLicense")
    fun recognizeDrivingLicense(
        @Query("imgUrl") imgUrl: String
    ): Observable<CommonResponseBean<OcrPersonBean>>

    /**
     * 银行卡识别
     * */
    @GET(BASE_URL + "ocr/aliyunOcr/recognizeBankCard")
    fun recognizeBankCard(
        @Query("imgUrl") imgUrl: String
    ): Observable<CommonResponseBean<OcrPersonBean>>

    /**
     * 行驶证识别
     * */
    @GET(BASE_URL + "ocr/aliyunOcr/recognizeVehicleLicense")
    fun recognizeVehicleLicense(
        @Query("imgUrl") imgUrl: String
    ): Observable<CommonResponseBean<OcrPersonBean>>

    /**
     * 营业执照识别
     * */
    @GET(BASE_URL + "ocr/aliyunOcr/recognizeBusinessLicense")
    fun recognizeBusinessLicense(
        @Query("imgUrl") imgUrl: String
    ): Observable<CommonResponseBean<OcrPersonBean>>

    /**
     * 获取用户信息
     * */
    @GET(BASE_URL + "driver/driver/getUserInfo")
    fun getUserInfo(): Observable<CommonResponseBean<UserBean>>

    /**
     * 司机上传身份证
     * */
    @POST(BASE_URL + "driver/driver/setUpDriverIdCard")
    fun setUpDriverIdCard(@Body carBean: UpPersonInfoBean): Observable<CommonResponseBean<String>>


    /**
     * 司机上传驾驶证
     * */
    @POST(BASE_URL + "driver/driver/setUpDriverLicense")
    fun setUpDriverLicense(@Body driverBean: UpDriverInfoBean): Observable<CommonResponseBean<String>>

    /**
     * 司机上传从业资格证
     * */
    @POST(BASE_URL + "driver/driver/setUpDriverQualificationCertificate")
    fun setUpDriverQualificationCertificate(@Body qualiBean: UpQualiInfoBean): Observable<CommonResponseBean<String>>

    /**
     * 司机上传银行卡
     * */
    @POST(BASE_URL + "driver/driver/setUpDriverBankCard")
    fun setUpDriverBankCard(@Body bankBean: UpBankInfoBean): Observable<CommonResponseBean<String>>


    /**
     * 司机认证成为车队长
     * */
    @POST(BASE_URL + "driver/driver/authenticationCaptain")
    fun authenticationCaptain(@Body bankBean: AuthTeamBean): Observable<CommonResponseBean<String>>


    /**
     * 货源列表
     * */
    @GET(BASE_URL + "driver/order/list")
    fun orderList(): Observable<CommonResponseBean<MutableList<OrderBean>>>

    /**
     * 运单列表
     * */
    @GET(BASE_URL + "driver/driverWaybill/selectMyWaybillList")
    fun selectMyWaybillList(
        @Query("pageNum") pageNum: Int = 1,
        @Query("pageSize") pageSize: Int = 20,
        @Query("waybillStatus") waybillStatus: String ="",
        @Query("searchValue") searchValue: String = ""
    ): Observable<CommonResponseBean<MutableList<OrderBean>>>


    /**
     * 货源详情
     * */
    @GET(BASE_URL + "driver/order/detail")
    fun orderDetail(@Query("orderId") orderId: String): Observable<CommonResponseBean<OrderDetailBean>>

    /**
     * 司机接单
     * */
    @GET(BASE_URL + "driver/driverWaybill/receivingOrders")
    fun receivingOrders(
        @Query("orderId") orderId: String,
        @Query("carId") carId: String
    ): Observable<CommonResponseBean<String>>

    /**
     * 司机装卸货
     * */
    @POST(BASE_URL + "driver/driverWaybill/driverLoadOrUnload")
    fun driverLoadOrUnload(
        @Body upPicBean: UpPicBean
    ): Observable<CommonResponseBean<String>>


    @GET(BASE_URL + "driver/driver/setUpDriverRole")
    fun setUpDriverRole(@Query("role") role: String): Observable<CommonResponseBean<String>>

    companion object {
        //    String BASE_URL = "https://tmstest.dahehuoyun.com/";
        const val BASE_URL = BuildConfig.BASE_URL

        //获取版本
        const val VERSION = BASE_URL + "app/version"
    }
}