package com.prolog.eis.feign;

import com.prolog.eis.core.dto.route.*;
import com.prolog.eis.core.model.biz.carry.CarryTask;
import com.prolog.eis.core.model.biz.carry.CarryTaskCallback;
import com.prolog.eis.core.model.biz.route.ContainerLocation;
import com.prolog.eis.router.vo.ContainerLocationVo;
import com.prolog.framework.common.message.RestMessage;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author ：cb
 * @date ：Created in 2022/3/5 13:56
 */
@FeignClient(value = "${prolog.service.route:service-ai-eis-route-center}")
public interface RouteFeign {

    /**
     * 容器下架
     *
     * @return
     */
    @PostMapping("/api/v1/route/location/containerOffShelf")
    RestMessage<String> containerOffShelf(@RequestBody String json);

    /**
     * 查询区域内所有的搬运任务
     *
     * @return
     */
    @PostMapping("/api/v1/route/carry/findAllCallback")
    RestMessage<List<CarryTaskCallbackDto>> findAllCallback();

    @PostMapping("/api/v1/route/carry/toCallbackHis")
    RestMessage<String> toCallbackHis(@RequestBody CarryTaskCallback carryTaskCallback);

    /**
     * 根据货位编号批量查询
     *
     * @param data
     * @return
     */
    @PostMapping("/api/v1/route/location/getContainerByLocations")
    RestMessage<List<ContainerLocation>> getContainerByLocations(@RequestBody List<String> data);

    /**
     * 根据容器集合查询位置以及货位
     *
     * @return
     */
    @PostMapping("/api/v1/route/location/findLocationByContainerList")
    RestMessage<List<ContainerLocationVo>> findLocationByContainerList(@RequestBody List<String> containerList);

    /**
     * 创建搬运任务
     *
     * @param carryTask
     * @return
     */
    @PostMapping("/api/v1/route/carry/createTask")
    RestMessage<String> createCarry(@RequestBody CarryTask carryTask);


    @ApiOperation(value = "搬运任务接口批量生成", notes = "搬运任务接口批量生成")
    @PostMapping("/api/v1/route/carry/createBatchCarry")
    RestMessage<String> createBatchCarry(@RequestBody List<CarryTask> carryTaskList);

    /**
     * 通过多个终点区域查询点位信息
     *
     * @param endRegionList
     * @return
     */
    @PostMapping("/api/v1/route/location/findContainerLocationListByEndRegionList")
    RestMessage<List<ContainerLocation>> findContainerLocationListByEndRegionList(
            @RequestBody List<String> endRegionList);

    /**
     * 托盘点位查询（托盘的状态 执行，到位）
     *
     * @return
     */
    @PostMapping("/api/v1/route/location/findContainerLocation")
    RestMessage<String> findContainerLocation(@RequestBody String json);

    /**
     * 上架
     *
     * @param json
     * @return
     */
    @PostMapping("/api/v1/route/location/insert")
    RestMessage<String> insert(@RequestBody String json);

    /**
     * 商品点位容器创建
     *
     * @param reqDto
     * @return
     */
    @PostMapping("/api/v1/route/item/createItemContainer")
    RestMessage<String> createItemContainer(@RequestBody ItemContainerReqDto reqDto);

    /**
     * 根据终点区域集合查询搬运任务
     *
     * @param endRegionList
     * @return
     */
    @PostMapping("/findCarryTaskListByEndRegionList")
    RestMessage<List<CarryTask>> findCarryTaskListByEndRegionList(List<String> endRegionList);

    /**
     * 根据区域查询所有的点位信息
     *
     * @param areaList
     * @return
     */
    @PostMapping("/api/v1/route/location/findContainerLocationListByArea")
    public RestMessage<List<ContainerLocation>> findContainerLocationListByArea(List<String> areaList);

    /**
     * 查询某些区域的空闲托盘
     *
     * @param areaNos
     * @return
     */
    @PostMapping("/api/v1/route/location/findFreeContainerByAreaNo")
    RestMessage<List<ContainerLocation>> findFreeContainerByAreaNo(
            @RequestParam(value = "areaNos", required = false) String areaNos);

    /**
     * 搬运任务接口-包含角度
     *
     * @param createCarryTaskDto
     * @return
     */
    @PostMapping("/api/v1/route/carry/createTaskWithAngle")
    RestMessage<String> createTaskWithAngle(@RequestBody CreateCarryTaskDto createCarryTaskDto);

    /**
     * 搬运任务接口生成并执行-包含角度
     *
     * @param createCarryTaskDto
     * @return
     */
    @PostMapping("/api/v1/route/carry/creatCarryTaskWithAngleAndExecute")
    RestMessage<String> creatCarryTaskWithAngleAndExecute(@RequestBody CreateCarryTaskDto createCarryTaskDto);

    /**
     * 查询某个区域的占用托盘
     *
     * @return
     */
    @PostMapping("/api/v1/route/location/findLocationOccupyByAreaNo")
    RestMessage<List<ContainerLocationAreaLocationDto>> findLocationOccupyByAreaNo(
            @RequestBody ContainerLocationAreaDto containerLocationAreaDto);

    /**
     * 查询区域内所有的搬运任务
     *
     * @param json area
     * @return
     */
    @PostMapping("/api/v1/route/carry/findCarryTaskByArea")
    public RestMessage<List<CarryTaskDto>> findCarryTaskByArea(@RequestBody String json);


    @ApiOperation(value = "通过区域查询容器任务", notes = "通过区域查询容器任务")
    @PostMapping("/api/v1/route/location/areaContainerCount")
    RestMessage<List<AreaContainerCountDto>> areaContainerCount(@RequestBody List<AreaOrJointPointDto> areaOrJointPointDto);

    /**
     * 商品点位容器创建(批量)
     * @param commonContainerUpList
     * @return
     */
    @PostMapping("api/v1/route/location/commonContainerUpList")
    RestMessage<String> commonContainerUpList(@RequestBody List<ItemContainerReqDto> commonContainerUpList);

}
