package com.ningdatech.pmapi.sys.controller;

import com.wflow.bean.dto.WflowFormsDto;
import com.wflow.bean.vo.WflowFormVo;
import com.wflow.workflow.service.WflowFormsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Classname SysProcdefController
 * @Description
 * @Date 2023/1/18 14:28
 * @Author PoffyZhang
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/api/v1/sys/form")
@Api(value = "SysForm", tags = "系统管理-表单配置")
@RequiredArgsConstructor
public class FormController {

    private final WflowFormsService formService;

    @ApiOperation(value = "获取系统表单", notes = "获取系统表单")
    @GetMapping("/{regionCode}")
    public WflowFormVo detail(@PathVariable String regionCode) {
        return formService.getFormByRegionCode(regionCode);
    }

    @ApiOperation(value = "编辑系统表单", notes = "编辑系统表单")
    @PostMapping("/modify")
    public String modify(@Validated @RequestBody WflowFormsDto dto) {
        return formService.modifySysForm(dto);
    }
}
