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

import com.prolog.cs.biz.outbound.model.OmsDoBillHDO;
import com.prolog.cs.biz.outbound.model.dto.InfTaskOutBackDTO;
import com.prolog.cs.biz.outbound.model.dto.MoveTaskDODTO;
import com.prolog.cs.biz.outbound.model.dto.MoveTaskStatusSyncDTO;
import com.prolog.cs.biz.outbound.model.entity.MoveTaskDO;
import com.prolog.cs.biz.outbound.model.vo.CargoOwnerChangeVO;
import com.prolog.entity.vo.ApplyForPackageWeighVO;
import com.prolog.entity.vo.CompleteTaskVO;
import com.prolog.entity.vo.MarkTaskItemVO;
import com.prolog.framework.common.message.RestMessage;
import io.swagger.annotations.ApiOperation;
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 javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;

@FeignClient(value = "${prolog.service.outbound}")
public interface OutBoundClient {
    @PostMapping("/moveTask/add")
    RestMessage addMoveTask(@RequestBody List<MoveTaskDODTO> moveTasks);

    /**
     * 任务上架
     *
     * @param syncDTO 补货任务同步信息
     */
    @PostMapping("/moveTask/instore")
    RestMessage<Long> instore(@RequestBody MoveTaskStatusSyncDTO syncDTO);

    /**
     * 货主转换出库
     *
     * @param changeOuts 货主转换信息
     */
    @PostMapping("special-wave/cargoowner-change")
    RestMessage cargoOwnerChange(@RequestBody List<CargoOwnerChangeVO> changeOuts);

    @PostMapping("/outboundOrder/getDoBillHByBillNos")
    RestMessage<List<OmsDoBillHDO>> getDoBillHByBillNos(@RequestParam("billNos") String[] billNos, @RequestParam("warehouseId") String warehouseId);

    /**
     * 回传托盘拣货明细信息
     */
    @ApiOperation(value = "回传托盘拣货明细信息")
    @PostMapping("/picktask/v1/infTaskOutBack")
    RestMessage<Object> infTaskOutBack(@RequestBody InfTaskOutBackDTO infTaskOutBackDTO);

    @ApiOperation(value = "根据拣选任务明细ID查询补货信息")
    @GetMapping("/rf/picktask/ask/getReplenishListByPickTaskId")
    RestMessage<List<MoveTaskDO>> getReplenishListByPickTaskId(
            @RequestParam(value = "pickTaskId") @Valid @NotNull(message = "拣选任务明细ID不能为空") String pickTaskId,
            @RequestParam(value = "status") String status
    );

    @ApiOperation(value = "根据补货单明细ID获取补货任务")
    @PostMapping("/rf/picktask/ask/getReplenishTasksByIds")
    RestMessage<List<MoveTaskDO>> getReplenishTasksByIds(@RequestBody List<String> taskIds);

    @ApiOperation(value = "根据补货任务明细ID更新补货状态")
    @PostMapping("/rf/picktask/ask/updateTasksUnshelveByReplenish")
    RestMessage<Object>  updateTasksUnshelveByReplenish(@RequestBody Map<String, Object> params);

    @ApiOperation(value = "包裹称重请求分配")
    @PostMapping("/rf/outcheck/applyForPackageWeigh")
    RestMessage<Map<String, Object>> applyForPackageWeigh(@RequestBody ApplyForPackageWeighVO vo);

    @ApiOperation(value = "EIS作业完成回告")
    @PostMapping("/picktask/completeTask")
    RestMessage<Map<String, Object>> completeTask(@RequestBody List<CompleteTaskVO> list);

    @ApiOperation(value = "EIS命中回告，超补更新任务明细数量")
    @PostMapping("/picktask/changeTaskQty")
    RestMessage changeTaskQty(@RequestBody List<MarkTaskItemVO> list);

    @PostMapping("/moveTask/changeQty")
    RestMessage changeQty(@RequestBody List<MoveTaskDODTO> moveTaskDODTOS);

}
