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.mapper.intf.AppBaseLedService;
import org.wcs.model.dto.serve.led.AddBaseLedReq;
import org.wcs.model.dto.serve.led.QueryLedReq;
import org.wcs.model.dto.serve.led.UpdateBaseLedReq;
import org.wcs.model.vo.serve.AppServeDataResponse;
import org.wcs.model.vo.serve.AppServeResponse;
import org.wcs.model.vo.serve.led.QueryLedVo;
import org.wcs.serve.service.intf.ILedService;

import java.util.List;

/**
 * led 相关控制器
 */
@RestController
@RequestMapping("/app/led")
@ResponseBody
@RequiredArgsConstructor
public class LedController {

    private final ILedService ledService;

    /**
     * 查询LED屏基础资料
     * @param queryLedReq 查询LED屏基础资料请求
     * @return 查询结果
     */
    @PostMapping("/queryLed")
    public AppServeDataResponse<List<QueryLedVo>> queryLed(@RequestBody QueryLedReq queryLedReq) {
        return ledService.queryLed(queryLedReq);
    }

    /**
     * 新增LED屏基础资料
     * @param addBaseLedReq 新增LED屏基础资料请求
     * @return 新增结果
     */
    @PostMapping("/addBaseLed")
    public AppServeResponse addBaseLed(@RequestBody @Validated AddBaseLedReq addBaseLedReq) {
        return ledService.addBaseLed(addBaseLedReq);
    }

    /**
     * 修改LED屏基础资料
     * @param updateBaseLedReq 修改LED屏基础资料请求
     * @return 修改结果
     */
    @PostMapping("/updateBaseLed")
    public AppServeResponse updateBaseLed(@RequestBody @Validated UpdateBaseLedReq updateBaseLedReq) {
        return ledService.updateBaseLed(updateBaseLedReq);
    }

    /**
     * 删除LED屏基础资料
     * @param id LED屏基础资料ID
     * @return 删除结果
     */
    @DeleteMapping("/deleteBaseLed/{id}")
    public AppServeResponse deleteBaseLed(@PathVariable("id") @NotBlank(message = "id不能为空") String id) {
        return ledService.deleteBaseLed(id);
    }


}
