package com.wms_main.controller.mywms;

import com.wms_main.model.dto.request.mywms.AGVDoneReq;
import com.wms_main.model.dto.request.mywms.OrderInCancel;
import com.wms_main.model.dto.request.mywms.OrderInReq;
import com.wms_main.model.dto.request.mywms.OrderOutReq;
import com.wms_main.model.dto.request.mywms.QueryStandStatusReq;
import com.wms_main.model.dto.request.mywms.StockReq;
import com.wms_main.model.dto.request.mywms.StockRespGoodsDetail;
import com.wms_main.model.dto.response.mywms.MyWmsResponse;
import com.wms_main.model.dto.response.mywms.OrderResponse;
import com.wms_main.service.controller.IMyWmsControllerService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.GetMapping;

@RestController
@ResponseBody
@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/mywms")
@Slf4j
public class MyWmsController {

    private final IMyWmsControllerService myWmsControllerService;

    @PostMapping("/orderIn")
    public OrderResponse orderIn(@RequestBody OrderInReq request) {
        return myWmsControllerService.orderIn(request);
    }

    @PostMapping("/orderOut")
    public OrderResponse orderOut(@RequestBody OrderOutReq request) {
        return myWmsControllerService.orderOut(request);
    }

    @PostMapping("/stock")
    public MyWmsResponse<List<StockRespGoodsDetail>> stock(@RequestBody StockReq request) {
        return myWmsControllerService.stock(request);
    }

    @PostMapping("/agvNotify")
    public MyWmsResponse<Boolean> agvNotify(@RequestBody QueryStandStatusReq request) {
        return myWmsControllerService.queryStandStatus(request);
    }

    @PostMapping("/agvDone")
    public MyWmsResponse<Object> agvDone(@RequestBody AGVDoneReq request) {
        return myWmsControllerService.agvDone(request);
    }

    @PostMapping("/cancelOrderIn")
    public String cancelOrderIn(@RequestBody OrderInCancel request) {
        return myWmsControllerService.cancelOrderIn(request);
    }
    

    @GetMapping("/test")
    public String test() {
        return "success";
    }
}
