package cn.axzo.workflow.common.model.request.form.definition;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.util.Map;

/**
 * 表单定义中的字段相关属性入参模型
 *
 * @author wangli
 * @since 2023/7/20 10:39
 */
@ApiModel("表单定义中的字段相关属性入参模型")
@Data
public class FormFieldsDTO {

    @ApiModelProperty(value = "表单字段类型", hidden = true)
    @NotBlank(message = "字段类型不能为空")
    private transient String fieldType = "FormField";

    @ApiModelProperty(value = "前端的组件类型")
    private String type;

    @ApiModelProperty(value = "表单字段组件ID", example = "account")
    @NotBlank(message = "表单字段组件 ID 不能为空")
    private String id;

    @ApiModelProperty(value = "表单字段名称", example = "账号")
    private String name;

    @ApiModelProperty(value = "表单字段默认值", example = "account")
    private String value;

    @ApiModelProperty(value = "表单字段是否必填,默认 false", example = "true or false")
    private Boolean required = false;

    @ApiModelProperty(value = "表单字段是否只读,默认 false", example = "true or false")
    private Boolean readOnly = false;

    @ApiModelProperty(value = "表单字段占位提示")
    private String placeholder;

    @ApiModelProperty(value = "该表单字段的其他扩展属性,期望 JSON 格式")
    private Map<String, Object> params;
}


