package thyyxxk.webserver.controller.dashboardEditor;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dashboardEditor.TDashboardTemplate;
import thyyxxk.webserver.service.dashboardEditor.DashboardEditorService;

@RestController
@RequestMapping("/dashboardEditor")
@RequiredArgsConstructor
public class DashboardEditorController {
    private final DashboardEditorService service;

    @GetMapping("/getDashboardTemplateByWardCode")
    public ResultVo<TDashboardTemplate> getDashboardTemplateByWardCode(@RequestParam("wardCode") String wardCode,
                                                                       @RequestParam("templateType") Integer templateType
    ) {
        return service.getDashboardTemplateByWardCode(wardCode, templateType);
    }

    @PostMapping("/saveTemplate")
    public ResultVo<TDashboardTemplate> saveTemplate(@RequestBody TDashboardTemplate param) {
        return service.saveTemplate(param);
    }

    @GetMapping("/release")
    public ResultVo<String> release(@RequestParam("id") String id) {
        return service.release(id);
    }

}
