package com.wms_main.controller.mywms;

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.StockReq;
import com.wms_main.model.dto.request.mywms.StockRespGoodsDetail;
import com.wms_main.model.dto.response.mywms.MyWmsResponse;
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;

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

    private final IMyWmsControllerService myWmsControllerService;

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

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

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

    @GetMapping("/allowFeed")
    public MyWmsResponse<Boolean> canFeed() {
        return myWmsControllerService.queryCanFeed();
    }

    @GetMapping("/allowOut")
    public MyWmsResponse<Boolean> canOut() {
        return myWmsControllerService.queryCanOut();
    }
}
