package com.qmth.sop.business.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.sop.common.contant.SystemConstant;
import com.qmth.sop.common.enums.TFCustomTypeEnum;
import com.qmth.sop.common.enums.WidgetCodeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * <p>
 * 动态表单元数据表
 * </p>
 *
 * @author wangliang
 * @since 2023-08-29
 */
@ApiModel(value = "TDFormWidgetMetadata对象", description = "动态表单元数据表")
public class TDFormWidgetMetadata implements Serializable {

    private static final long serialVersionUID = 1L;

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

    @ApiModelProperty(value = "流程类型，OFFICE_SOP_FLOW：教务处SOP，CLOUD_MARK_SOP_FLOW：研究生SOP，DING_EXCEPTION_FLOW：考勤异常审核流程，PROJECT_EXCHANGE_FLOW：项目计划变更流程，QUALITY_PROBLEM_FLOW：质量问题反馈流程")
    @NotNull(message = "流程类型不能为空")
    private TFCustomTypeEnum type;

    @ApiModelProperty(value = "流程部署id")
    @NotBlank(message = "流程部署id不能为空")
    private String flowDeploymentId;

    @ApiModelProperty(value = "版本号")
    @NotNull(message = "流程版本号不能为空")
    private Integer version;

    @ApiModelProperty(value = "编码，TEXT：文本，NUMBER：数字文本，TEXTAREA：文本域，编码，TEXT：文本，TEXTAREA：文本域，SINGLE_SELECT：单选下拉框，MULTIPLE_SELECT：多选下拉框，RADIO：单选框，CHECKBOX：复选框，DATE：日期，BUTTON：按钮，IMG：图片，VIDEO：视频，AUDIO：音频，FILE：文件，LABEL：标签，TABLE：表格，SIGN：签名，CASCADE_ADDRESS：城市选择控件，OTHER：其它，FORM_GROUP_TITLE：带虚线分割线的标题，ONLY_TITLE：普通标题，独占一行，RADIO_WITH_INPUT：带1个输入框的单选框，DEVICE_IN_TABLE：设备入库表格，DEVICE_OUT_TABLE：设备出库表格，RADIO：单选框，CHECKBOX：复选框，DATE：日期，BUTTON：按钮，IMG：图片，VIDEO：视频，AUDIO：音频，FILE：文件，LABEL：标签，TABLE：表格，SIGN：签名，CASCADE_ADDRESS：城市选择控件，OTHER：其它，FORM_GROUP_TITLE：带虚线分割线的标题，ONLE_TITLE：普通标题，独占一行，RADIO_WITH_INPUT：带1个输入框的单选框，DEVICE_IN_TABLE：设备入库表格，DEVICE_OUT_TABLE：设备出库表格")
    @NotNull(message = "编码不能为空")
    private WidgetCodeEnum code;

    @ApiModelProperty(value = "字段id")
    @NotBlank(message = "字段id不能为空")
    private String fieldId;

    @ApiModelProperty(value = "字段名称")
    @NotBlank(message = "字段名称不能为空")
    private String fieldName;

    @ApiModelProperty(value = "字段标题")
    @NotBlank(message = "字段标题不能为空")
    private String fieldTitle;

    @ApiModelProperty(value = "流程步骤")
    @NotNull(message = "流程步骤不能为空")
    private Integer setup;

    @ApiModelProperty(value = "是否勾选，0：未勾选，1：勾选")
    private Boolean fieldCheck;

    @ApiModelProperty(value = "是否是项目计划变更关联字段，0：不是，1：是")
    private Boolean changeJoin;

    @ApiModelProperty(value = "创建时间")
    private Long createTime;

    public TDFormWidgetMetadata() {

    }

    public TDFormWidgetMetadata(TFCustomTypeEnum type, String flowDeploymentId, Integer version, Integer setup, WidgetCodeEnum code, String fieldId, String fieldName, String fieldTitle) {
        this.id = SystemConstant.getDbUuid();
        this.type = type;
        this.flowDeploymentId = flowDeploymentId;
        this.version = version;
        this.setup = setup;
        this.code = code;
        this.fieldId = fieldId;
        this.fieldName = fieldName;
        this.fieldTitle = fieldTitle;
        this.fieldCheck = false;
        this.createTime = System.currentTimeMillis();
    }

    public Long getId() {
        return id;
    }

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

    public Boolean getChangeJoin() {
        return changeJoin;
    }

    public void setChangeJoin(Boolean changeJoin) {
        this.changeJoin = changeJoin;
    }

    public Integer getSetup() {
        return setup;
    }

    public void setSetup(Integer setup) {
        this.setup = setup;
    }

    public Boolean getFieldCheck() {
        return fieldCheck;
    }

    public void setFieldCheck(Boolean fieldCheck) {
        this.fieldCheck = fieldCheck;
    }

    public WidgetCodeEnum getCode() {
        return code;
    }

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

    public TFCustomTypeEnum getType() {
        return type;
    }

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

    public String getFlowDeploymentId() {
        return flowDeploymentId;
    }

    public void setFlowDeploymentId(String flowDeploymentId) {
        this.flowDeploymentId = flowDeploymentId;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getFieldId() {
        return fieldId;
    }

    public void setFieldId(String fieldId) {
        this.fieldId = fieldId;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getFieldTitle() {
        return fieldTitle;
    }

    public void setFieldTitle(String fieldTitle) {
        this.fieldTitle = fieldTitle;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
}
