package com.wms_main.controller.wms;

import com.wms_main.model.dto.query.StandQuery;
import com.wms_main.model.dto.request.wms.UpdateStandRequest;
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
import com.wms_main.model.dto.response.wms.WmsApiResponse;
import com.wms_main.model.vo.wms.StandVo;
import com.wms_main.service.controller.IStandControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 站台控制器
 */
@RestController
@ResponseBody
@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/wms/stand")
public class StandController {

    private final IStandControllerService standControllerService;
    /**
     * 获取所有站台信息
     *
     * @param standQuery 查询参数
     * @return 站台信息列表
     */
    @PostMapping("/getAllStands")
    public WmsApiResponse<List<StandVo>> getAllStands(@RequestBody StandQuery standQuery) {
        return standControllerService.getAllStands(standQuery);
    }

    /**
     * 更新站台信息
     *
     * @param request 更新请求
     * @return 更新结果
     */
    @PostMapping("/updateStandInfo")
    public BaseWmsApiResponse updateStandInfo(@RequestBody UpdateStandRequest request) {
        return standControllerService.updateStandInfo(request);
    }

    /**
     * 关闭站台
     *
     * @param request 关闭请求
     * @return 关闭结果
     */
    @PostMapping("/closeStandInfo")
    public BaseWmsApiResponse closeStandInfo(@RequestBody UpdateStandRequest request) {
        return standControllerService.closeStandInfo(request);
    }
} 