package com.qmth.sop.business.bean.result;

import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.sop.common.enums.WidgetCodeEnum;
import com.qmth.sop.common.enums.WidgetInputTypeEnum;
import com.qmth.sop.common.enums.WidgetTypeEnum;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * @Description: 表单控件result
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2023/7/18
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class FlowFormWidgetResult implements Serializable {

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "主键")
    @TableId(value = "id")
    private Long id;

    @ApiModelProperty(value = "编码，TEXT：文本，TEXTAREA：文本域，SELECT：下拉框，RADIO：单选框，CHECKBOX：复选框，DATE：日期，BUTTON：按钮，IMG：图片，VIDEO：视频，AUDIO：音频，FILE：文件，LABEL：标签，TABLE：表格，OTHER：其它")
    private WidgetCodeEnum code;

    @ApiModelProperty(value = "类型，FORM：表单，TABLE：表格，OTHER：其它")
    private WidgetTypeEnum type;

    @ApiModelProperty(value = "表单id")
    private String formId;

    @ApiModelProperty(value = "表单名称")
    private String formName;

    @ApiModelProperty(value = "标题")
    private String title;

    @ApiModelProperty(value = "输入类型，STRING：字符串，INT：整型，LONG：长整型，DOUBLE：浮点型，ENUM：枚举，DATE：日期，BOOL：布尔，BIGDECIMAL：精确浮点")
    private WidgetInputTypeEnum inputType;

    @ApiModelProperty(value = "是否必填，0：非必填，1：必填")
    private Boolean required;

    @ApiModelProperty(value = "是否只读，0：非只读，1：只读")
    private Boolean readable;

    @ApiModelProperty(value = "是否可写，0：非可写，1：可写")
    private Boolean writable;

    @ApiModelProperty(value = "是否可见，0：不可见，1：可见")
    private Boolean visable;

    @ApiModelProperty(value = "保留小数点几位")
    private Integer scale;

    @ApiModelProperty(value = "长度")
    private Integer length;

    @ApiModelProperty(value = "绑定字段")
    private String binding;

    @ApiModelProperty(value = "控件用值")
    private String value;

    @ApiModelProperty(value = "数据来源")
    private String dataGrid;

    @ApiModelProperty(value = "提示")
    private String tips;

    @ApiModelProperty(value = "格式化")
    private String format;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "占宽符")
    private Integer span;

    @ApiModelProperty(value = "子标题")
    private String subTitle;

    @ApiModelProperty(value = "表格信息")
    private List<FlowTablePropResult> tablePropList;

    @ApiModelProperty(value = "选项值，RADIO或CHECKBOX填此值")
    private String options;

    @ApiModelProperty(value = "控件组")
    private Integer formGroup;

    @ApiModelProperty(value = "角色类型")
    private String roleType;

    public Integer getFormGroup() {
        return formGroup;
    }

    public void setFormGroup(Integer formGroup) {
        this.formGroup = formGroup;
    }

    public String getRoleType() {
        return roleType;
    }

    public void setRoleType(String roleType) {
        this.roleType = roleType;
    }

    public String getOptions() {
        return options;
    }

    public void setOptions(String options) {
        this.options = options;
    }

    public String getSubTitle() {
        return subTitle;
    }

    public void setSubTitle(String subTitle) {
        this.subTitle = subTitle;
    }

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }

    public String getBinding() {
        return binding;
    }

    public void setBinding(String binding) {
        this.binding = binding;
    }

    public Integer getSpan() {
        return span;
    }

    public void setSpan(Integer span) {
        this.span = span;
    }

    public String getName() {
        if (Objects.nonNull(this.code)) {
            return this.code.getTitle();
        } else {
            return name;
        }
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<FlowTablePropResult> getTablePropList() {
        return tablePropList;
    }

    public void setTablePropList(List<FlowTablePropResult> tablePropList) {
        this.tablePropList = tablePropList;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public WidgetCodeEnum getCode() {
        return code;
    }

    public void setCode(WidgetCodeEnum code) {
        this.code = code;
    }

    public WidgetTypeEnum getType() {
        return type;
    }

    public void setType(WidgetTypeEnum type) {
        this.type = type;
    }

    public String getFormId() {
        return formId;
    }

    public void setFormId(String formId) {
        this.formId = formId;
    }

    public String getFormName() {
        return formName;
    }

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

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public WidgetInputTypeEnum getInputType() {
        return inputType;
    }

    public void setInputType(WidgetInputTypeEnum inputType) {
        this.inputType = inputType;
    }

    public Boolean getRequired() {
        return required;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public Boolean getReadable() {
        return readable;
    }

    public void setReadable(Boolean readable) {
        this.readable = readable;
    }

    public Boolean getWritable() {
        return writable;
    }

    public void setWritable(Boolean writable) {
        this.writable = writable;
    }

    public Boolean getVisable() {
        return visable;
    }

    public void setVisable(Boolean visable) {
        this.visable = visable;
    }

    public Integer getScale() {
        return scale;
    }

    public void setScale(Integer scale) {
        this.scale = scale;
    }

    public Integer getLength() {
        return length;
    }

    public void setLength(Integer length) {
        this.length = length;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getDataGrid() {
        return dataGrid;
    }

    public void setDataGrid(String dataGrid) {
        this.dataGrid = dataGrid;
    }

    public String getTips() {
        return tips;
    }

    public void setTips(String tips) {
        this.tips = tips;
    }
}
