package ink.wgink.module.form.pojo.vos.design;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import ink.wgink.annotation.CheckEmptyAnnotation;
import ink.wgink.annotation.CheckListAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 表单设计
 * @Author: WenG
 * @Date: 2022/3/8 20:21
 * @Version: 1.0
 **/
@ApiModel
public class FormDesignVO {

    @ApiModelProperty(name = "formCode", value = "表单编码")
    private String formCode;
    @ApiModelProperty(name = "formName", value = "表单名称")
    @CheckEmptyAnnotation(name = "表单名称")
    private String formName;
    @ApiModelProperty(name = "formSummary", value = "表单描述")
    @CheckEmptyAnnotation(name = "表单描述")
    private String formSummary;
    @ApiModelProperty(name = "formVersion", value = "表单版本")
    private Integer formVersion;
    @ApiModelProperty(name = "mainTitleTpl", value = "主标题模板")
    private String mainTitleTpl;
    @ApiModelProperty(name = "formType", value = "表单类型")
    @CheckEmptyAnnotation(name = "表单类型")
    private String formType;
    private JSONArray data;
    @CheckListAnnotation(name = "fields", value = "字段列表")
    private List<Field> fields;

    public String getFormCode() {
        return formCode == null ? "" : formCode.trim();
    }

    public void setFormCode(String formCode) {
        this.formCode = formCode;
    }

    public String getFormName() {
        return formName == null ? "" : formName.trim();
    }

    public void setFormName(String formName) {
        this.formName = formName;
    }

    public String getFormSummary() {
        return formSummary == null ? "" : formSummary.trim();
    }

    public void setFormSummary(String formSummary) {
        this.formSummary = formSummary;
    }

    public Integer getFormVersion() {
        return formVersion == null ? 0 : formVersion;
    }

    public void setFormVersion(Integer formVersion) {
        this.formVersion = formVersion;
    }

    public String getMainTitleTpl() {
        return mainTitleTpl == null ? "" : mainTitleTpl.trim();
    }

    public void setMainTitleTpl(String mainTitleTpl) {
        this.mainTitleTpl = mainTitleTpl;
    }

    public String getFormType() {
        return formType == null ? "" : formType.trim();
    }

    public void setFormType(String formType) {
        this.formType = formType;
    }

    public JSONArray getData() {
        return data;
    }

    public void setData(JSONArray data) {
        this.data = data;
    }

    public List<Field> getFields() {
        return fields == null ? new ArrayList<>() : fields;
    }

    public void setFields(List<Field> fields) {
        this.fields = fields;
    }

    public static class Field {
        private JSONObject data;
        private String html;

        public JSONObject getData() {
            return data;
        }

        public void setData(JSONObject data) {
            this.data = data;
        }

        public String getHtml() {
            return html == null ? "" : html.trim();
        }

        public void setHtml(String html) {
            this.html = html;
        }
    }
}
