package ink.wgink.module.form.controller.api.design;


import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.module.form.pojo.vos.design.FormDesignVO;
import ink.wgink.module.form.service.design.IFormDesignService;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "表单设计")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/form-design")
public class FormDesignController extends DefaultBaseController {

    @Autowired
    private IFormDesignService formDesignService;

    @ApiOperation(value = "保存表单", notes = "保存表单接口")
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @PostMapping("save")
    @CheckRequestBodyAnnotation
    public SuccessResult save(@RequestBody FormDesignVO formDesignVO) throws IOException {
        formDesignService.save(formDesignVO);
        return new SuccessResult();
    }

}
