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

import com.fasterxml.jackson.annotation.JsonInclude;
import com.qmth.sop.common.enums.WidgetCodeEnum;
import io.swagger.annotations.ApiModelProperty;

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

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

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

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

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

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

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

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

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

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

    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 String getName() {
        if (Objects.nonNull(this.code)) {
            return this.code.getTitle();
        } else {
            return name;
        }
    }

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

    public WidgetCodeEnum getCode() {
        return code;
    }

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

    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;
    }
}
