package com.wms_main.controller.wms;

import com.wms_main.model.dto.query.ConfigQuery;
import com.wms_main.model.dto.request.wms.ConfigUpdateRequest;
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.ConfigVo;
import com.wms_main.model.vo.wms.PageVo;
import com.wms_main.service.controller.IConfigControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 配置控制类
 */
@RestController
@ResponseBody
@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/wms/config")
public class ConfigController {
    private final IConfigControllerService configControllerService;

    /**
     * 配置查询
     * @param configQuery 查询参数
     * @return 查询结果
     */
    @PostMapping("/queryConfigsByPage")
    public WmsApiResponse<PageVo<ConfigVo>> queryConfigsByPage(@RequestBody ConfigQuery configQuery) {
        return configControllerService.queryConfigsByPage(configQuery);
    }

    /**
     * 配置更新
     * @param configUpdateRequest 更新请求
     * @return 更新结果
     */
    @PostMapping("/updateConfig")
    public BaseWmsApiResponse updateConfig(@RequestBody ConfigUpdateRequest configUpdateRequest) {
        return configControllerService.updateConfig(configUpdateRequest);
    }

}
