package com.baoshi.swms.net.api;

import androidx.annotation.Nullable;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * WAS API ROUTER(PHP)
 *
 * @author Zhendong Zhou
 * @date   2021/12/3 15:55
 */
public interface WasApi{
    @POST("login")
    @FormUrlEncoded
    Observable<ResponseBody> login(@Field("username") String username, @Field("password") String password);

    @GET("order/batchRecover")
    Observable<ResponseBody> recover(@Query("code") String batch);

    @POST("waybill/dispatch/dailyBilling")
    @FormUrlEncoded
    Observable<ResponseBody> dailyBilling(@Field("deliver_at") String deliverAt, @Field("fee") double fee);

    @POST("waybill/dispatch")
    @FormUrlEncoded
    Observable<ResponseBody> dispatch(@FieldMap Map<String,String> map);

    @GET("waybill/dispatch")
    Observable<ResponseBody> getDispatchList(@Query("search") String searchTxt, @Nullable @Query("deliver_at") String deliverAt, @Query("page") Integer page, @Query("paginate") Integer paginate);

    @GET("inventory/inventoryTask")
    Observable<ResponseBody> getStocktaking(@Query("taskId") String stocktakingId);

    @POST("inventory/locationInvPro")
    @FormUrlEncoded
    Observable<ResponseBody> getLocStocktakingRatio(@Field("taskId") Long stocktakingId, @Field("location") String location);

    @POST("inventory/getInventoryDetail")
    @FormUrlEncoded
    Observable<ResponseBody> getLocGoodsInfo(@Field("taskId") Long stocktakingId, @Field("location") String location, @Field("barcode") String barcode);

    @POST("inventory/stockInventory")
    Observable<ResponseBody> stocktaking(@FieldMap Map<String,Object> map);
}
