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

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
 */
public class FormWidgetResult 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 name;

    public WidgetCodeEnum getCode() {
        return code;
    }

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

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

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