package com.gingersoft.supply_chain.mvp.server;

import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean;
import com.gingersoft.supply_chain.mvp.bean.MeasurementUnitBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderResultBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierResultBean;

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

import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.QueryName;

/**
 * @author 宇航.
 * User: admin
 * Date: 2020/11/20
 * Time: 15:29
 * Use:
 */
public interface SupplierServer {
    /**
     * 新增供應商
     *
     * @param requestBody
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("supplier/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> addSupplier(@Body RequestBody requestBody);

    /**
     * 獲取供應商列表
     *
     * @param map
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("supplier/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<SupplierResultBean> getSupplierList(@QueryMap Map<String, Object> map);

    /**
     * 修改供應商信息
     *
     * @param requestBody
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("supplier/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> updateSupplier(@Body RequestBody requestBody);

    /**
     * 獲取供應商聯繫方式
     *
     * @param supplierId
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("supplier/contact/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> getSupplierContact(@Query("supplierId") String supplierId);

    /**
     * 獲取供應商聯繫方式
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("supplier/contact/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> updateSupplierContact(@Body RequestBody requestBody);

    /**
     * 批量新增供應商聯繫方式
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("/supplier/contact/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> addSupplierContact(@Body RequestBody requestBody);

    /**
     * 獲取食品單位列表集合
     *
     * @param map
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("foodUnit/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<MeasurementUnitBean> getMeasurementUnitList(@QueryMap Map<String, Object> map);

    /**
     * 修改食品單位
     *
     * @param requestBody
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("foodUnit/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> updateFoodUnit(@Body RequestBody requestBody);

    /**
     * 獲取食品分類
     *
     * @param map
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("foodCategory/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<FoodCategoryResultBean> getFoodCategoryList(@QueryMap Map<String, Object> map);

    /**
     * 新增食品單位
     *
     * @param requestBody
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("foodUnit/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> addFoodUnit(@Body RequestBody requestBody);

    /**
     * 新增分類
     *
     * @param requestBody
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("foodCategory/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> addFoodCategory(@Body RequestBody requestBody);

    /**
     * 修改分類
     *
     * @param requestBody
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("foodCategory/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> updateFoodCategory(@Body RequestBody requestBody);

    /**
     * 上傳圖片
     *
     * @param parts
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @Multipart
    @POST("purchaseFood/image/upload" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> upLoadPic(@Part List<MultipartBody.Part> parts);

    /**
     * 新增食品
     *
     * @param requestBody
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("purchaseFood/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> addFood(@Body RequestBody requestBody);

    /**
     * 根據供應商獲取食品集合信息
     *
     * @param map
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("supplier/purchaseFood/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<FoodListInfoBean> getFoodIngredientsData(@QueryMap Map<String, Object> map);

    /**
     * 和上面的是同一個接口，返回數據不一致
     *
     * @param map
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("supplier/purchaseFood/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> getFoodBySupplierId(@QueryMap Map<String, Object> map);

    /**
     * 修改食材信息
     *
     * @param requestBody
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("purchaseFood/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> updateFood(@Body RequestBody requestBody);

    /**
     * 獲取採購單列表
     *
     * @param map
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("purchaseOrder/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<PurchaseOrderResultBean> getOrderList(@QueryMap Map<String, Object> map);

    /**
     * 修改採購單信息
     *
     * @param requestBody
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("purchaseOrder/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> updateOrder(@Body RequestBody requestBody);

    /**
     * 獲取下單頁面的分類結構
     *
     * @param map
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("foodCategory/tree/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<OrderCategoryBean> getCategoryTrees(@QueryMap Map<String, Object> map);

    /**
     * 新增採購訂單
     *
     * @param requestBody
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("purchaseOrder/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> addNewPurchaseOrder(@Body RequestBody requestBody);

    /**
     * 獲取下單頁面的分類結構
     *
     * @param map
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("foodCategory/subset/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<FoodByCategoryResultBean> getFoodByCategory(@QueryMap Map<String, Object> map);

    /**
     * 獲取訂單生成後用於展示的鏈接
     *
     * @param orderId
     * @return
     */
    @FormUrlEncoded
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("purchaseOrder/upload" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> getPurchaseOrderQrCode(@Field("orderId") String orderId);

    /**
     * 根據用戶選擇的類型發送消息
     *
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("purchaseOrderSend/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> sendMsg(@Body RequestBody requestBody);

    /**
     * 獲取訂單詳情
     *
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("purchaseOrder/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> getOrderDetailsById(@Query("orderId") int orderId);


    /**
     * 添加入庫
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("purchaseOrder/warehousing/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> addWarehouse(@Body RequestBody requestBody);

    /**
     * 獲取訂單詳情
     *
     * @return
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("purchaseWarehousingOrder/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> getWareHouseList(@QueryMap Map<String, Object> map);


    /**
     * 獲取基本單位
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @GET("basicUnitType/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> getDeputyUnitList(@Query("brandId") int brandId, @Query("restaurantId") int restaurantId);


    /**
     * 批量修改副單位
     */
    @Headers({"Domain-Name: ricepon-purchase"})
    @POST("basicUnitType/set" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
    Observable<BaseResult> updateDeputyUnitList(@Body RequestBody requestBody);

}
