package com.cm.common.plugin.pojo.vos.dynamic;

import com.cm.common.annotation.CheckEmptyAnnotation;
import com.cm.common.annotation.CheckListAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: DynamicFormVO
 * @Description: 动态表单
 * @Author: WangGeng
 * @Date: 2019/12/2 4:10 下午
 * @Version: 1.0
 **/
@ApiModel
public class DynamicFormVO {

    @ApiModelProperty(name = "tableName", value = "表名")
    @CheckEmptyAnnotation(name = "表名")
    private String tableName;
    @CheckListAnnotation(name = "字段列表")
    private List<DynamicFormFieldVO> dynamicFormFields;

    public String getTableName() {
        return tableName == null ? "" : tableName.trim();
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public List<DynamicFormFieldVO> getDynamicFormFields() {
        return dynamicFormFields;
    }

    public void setDynamicFormFields(List<DynamicFormFieldVO> dynamicFormFields) {
        this.dynamicFormFields = dynamicFormFields;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"tableName\":")
                .append("\"").append(tableName).append("\"");
        sb.append(",\"dynamicFormFields\":")
                .append(dynamicFormFields);
        sb.append('}');
        return sb.toString();
    }
}
