package com.prolog.upcloud.base.wh.operate.resource;

import com.prolog.cs.basic.warehouse.model.BaseWmsWarehouseArea;
import com.prolog.cs.basic.warehouse.model.BaseWmsWarehouseLocator;
import com.prolog.cs.basic.warehouse.model.BaseWmsWarehouseMst;
import com.prolog.cs.basic.warehouse.model.dto.WmsWhBldgDTO;
import com.prolog.cs.basic.warehouse.model.vo.ContainerQueryVO;
import com.prolog.cs.basic.warehouse.model.vo.WarehouseLocatorBasicInfo;
import com.prolog.cs.basic.warehouse.model.vo.WhLocatorQueryVO;
import com.prolog.framework.common.message.RestMessage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.List;

@FeignClient(value = "${prolog.service.warehouse}")
public interface WarehouseClient {

    /**
     * 批量查询仓库基础信息
     *
     * @return 仓库基础信息
     */
    @GetMapping("/warehouse/basic/list")
    RestMessage<List<BaseWmsWarehouseMst>> getWarehouseBasicInfo(@RequestParam("warehouseIds") String[] warehouseIds);

    /**
     * 批量查询库位基础信息
     *
     * @return 库位基础信息
     */
    @GetMapping("/locator/basic/list")
    RestMessage<List<WarehouseLocatorBasicInfo>> getLocationBasicInfos(@RequestParam("locatorIds") String[] locationIds);

    /**
     * 批量查询库位基础信息
     *
     * @param locationCodes 库位编号集合
     * @return 库位基础信息
     */
    @GetMapping("/locator/info-code/list")
    RestMessage<List<WarehouseLocatorBasicInfo>> getLocatorBasicListByCode(@RequestParam("warehouseId") String warehouseId, @RequestParam("locationCodes") String[] locationCodes);

    /**
     * 根据货位编号查询库位基础信息
     *
     * @param locationCode 货位编号
     * @return
     */
    @GetMapping("/locator/info-code")
    RestMessage<WarehouseLocatorBasicInfo> getLocationInfoByCode(@RequestParam("warehouseId") String warehouseId, @RequestParam("locationCode") String locationCode);

    /**
     * 根据逻辑区集合查询库位基础信息
     *
     * @param logicIds 逻辑区编号
     * @return
     */
    @GetMapping("/locator/info-logic/list")
    RestMessage<List<WarehouseLocatorBasicInfo>> getLocationListByLogic(String[] logicIds);

    /**
     * 批量查询库位详细信息
     *
     * @return 库位详细信息
     */
    @GetMapping("/locator/detail/list")
    RestMessage<List<HashMap<String, Object>>> getLocationDetailInfos(@RequestParam("locatorIds") String[] locatorIds);

    /**
     * 批量查询建筑物基础信息
     */
    @GetMapping("/wmsWhBldg/basic/list")
    RestMessage<List<WmsWhBldgDTO>> getBldgBasicInfoList(@RequestParam("bldgIds") String[] bldgIds);

    /**
     * 获取仓库信息
     */
    @GetMapping("/warehouse")
    public RestMessage<BaseWmsWarehouseMst> getById(@RequestParam("id") String id);

    @GetMapping("/baseWmsWarehouseArea/basic/getByAreaCodes")
    RestMessage<List<BaseWmsWarehouseArea>> getByAreaCodes(@RequestParam("warehouseId") String warehouseId, @RequestParam(name = "warehouseAreaCodes", required = false) String[] warehouseAreaCodes);

    @GetMapping("/baseWmsWarehouseArea/page2")
    RestMessage<Object> getAreaInfoByAreaCategorys(@RequestParam("enterpriseId") String enterpriseId, @RequestParam("warehouseId") String warehouseId, @RequestParam("warehouseAreaCategory") String[] warehouseAreaCategorys);

    /**
     * 容器释放
     */
    @PostMapping("/container/release")
    RestMessage<Object> release(@RequestBody ContainerQueryVO queryVO);

    @PostMapping("/locator/list")
    public RestMessage<List<BaseWmsWarehouseLocator>> locatorList(@RequestBody WhLocatorQueryVO queryVO);
}