package org.wcs.serve.controller.app;

import jakarta.validation.constraints.NotBlank;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.wcs.model.dto.serve.conveyStand.*;
import org.wcs.model.vo.serve.AppServeDataResponse;
import org.wcs.model.vo.serve.AppServeResponse;
import org.wcs.model.vo.serve.common.PageDataResponse;
import org.wcs.model.vo.serve.conveyStand.ConveyCheckStandVo;
import org.wcs.model.vo.serve.conveyStand.ConveyDeliverStandVo;
import org.wcs.model.vo.serve.conveyStand.ConveyPickStandVo;
import org.wcs.serve.service.intf.IConveyStandService;

/**
 * 输送线站台
 */
@RestController
@RequestMapping("/app/conveyStand")
@ResponseBody
@RequiredArgsConstructor
public class ConveyStandController {

    private final IConveyStandService conveyStandService;

    /**
     * 查询捡货站台
     * @param request 查询参数
     * @param pageSize 每页数量
     * @param pageIndex 页码
     * @return 站台列表
     */
    @PostMapping("queryPickStand")
    public AppServeDataResponse<PageDataResponse<ConveyPickStandVo>> queryPickStand(@RequestBody QueryPickStandReq request, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageIndex") Integer pageIndex) {
        return conveyStandService.queryPickStand(request, pageSize, pageIndex);
    }

    /**
     * 添加捡选站台
     * @param request 添加参数
     * @return 结果
     */
    @PostMapping("addConveyPickStand")
    public AppServeResponse addConveyPickStand(@RequestBody @Validated AddConveyPickStandReq request) {
        return conveyStandService.addConveyPickStand(request);
    }

    /**
     * 删除捡选站台
     * @param standId 站台ID
     * @return 删除结果
     */
    @DeleteMapping("deleteConveyPickStand")
    public AppServeResponse deleteConveyPickStand(@RequestParam("standId") @NotBlank(message = "站台ID不能为空") String standId) {
        return conveyStandService.deleteConveyPickStand(standId);
    }

    /**
     * 修改捡选站台
     * @param request 修改参数
     * @return 修改结果
     */
    @PostMapping("updateConveyPickStand")
    public AppServeResponse updateConveyPickStand(@RequestBody @Validated UpdateConveyPickStandReq request) {
        return conveyStandService.updateConveyPickStand(request);
    }

    /**
     * 查询复核站台
     * @param request 查询参数
     * @param pageSize 每页数量
     * @param pageIndex 页码
     * @return 站台列表
     */
    @PostMapping("queryCheckStand")
    public AppServeDataResponse<PageDataResponse<ConveyCheckStandVo>> queryCheckStand(@RequestBody QueryCheckStandReq request, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageIndex") Integer pageIndex) {
        return conveyStandService.queryCheckStand(request, pageSize, pageIndex);
    }


    /**
     * 添加复核站台
     * @param request 添加参数
     * @return 添加结果
     */
    @PostMapping("addConveyCheckStand")
    public AppServeResponse addConveyCheckStand(@RequestBody @Validated AddConveyCheckStandReq request) {
        return conveyStandService.addConveyCheckStand(request);
    }

    /**
     * 删除复核站台
     * @param standId 站台ID
     * @return 删除结果
     */
    @DeleteMapping("deleteConveyCheckStand")
    public AppServeResponse deleteConveyCheckStand(@RequestParam("standId") @NotBlank(message = "站台ID不能为空") String standId) {
        return conveyStandService.deleteConveyCheckStand(standId);
    }

    /**
     * 修改复核站台
     * @param request 修改参数
     * @return 修改结果
     */
    @PostMapping("updateConveyCheckStand")
    public AppServeResponse updateConveyCheckStand(@RequestBody @Validated UpdateConveyCheckStandReq request) {
        return conveyStandService.updateConveyCheckStand(request);
    }

    /**
     * 查询输送线发货站台
     * @param request 添加参数
     * @return 添加结果
     */
    @PostMapping("queryDeliverStand")
    public AppServeDataResponse<PageDataResponse<ConveyDeliverStandVo>> queryDeliverStand(@RequestBody QueryDeliverStandReq request, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageIndex") Integer pageIndex) {
        return conveyStandService.queryDeliverStand(request, pageSize, pageIndex);
    }

    /**
     * 添加输送线发货站台
     * @param request 添加参数
     * @return 添加结果
     */
    @PostMapping("addConveyDeliverStand")
    public AppServeResponse addConveyDeliverStand(@RequestBody @Validated AddConveyDeliverStandReq request) {
        return conveyStandService.addConveyDeliverStand(request);
    }

    /**
     * 删除输送线发货站台
     * @param standId 站台ID
     * @return 删除结果
     */
    @DeleteMapping("deleteConveyDeliverStand")
    public AppServeResponse deleteConveyDeliverStand(@RequestParam("standId") @NotBlank(message = "站台ID不能为空") String standId) {
        return conveyStandService.deleteConveyDeliverStand(standId);
    }

    /**
     * 修改输送线发货站台
     * @param request 添加参数
     * @return 添加结果
     */
    @PostMapping("updateConveyDeliverStand")
    public AppServeResponse updateConveyDeliverStand(@RequestBody @Validated UpdateConveyDeliverStandReq request) {
        return conveyStandService.updateConveyDeliverStand(request);
    }


}
