package cn.estsh.i3plus.pojo.lac.bean;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.LacEnumUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @Description :
 * <per>
 * <br/>    create table LacSuitTaskParam(
 * <br/>        suitTaskId           bigint                         null,
 * <br/>        suitTaskName         varchar(50)                    null,
 * <br/>        suitTaskCode         varchar(50)                    null,
 * <br/>        paramName            varchar(50)                    null,
 * <br/>        paramType            int                            null,
 * <br/>        paramValueType       int                            null,
 * <br/>        defaultValue         varchar(50)                    null,
 * <br/>        paramDescrition      varchar(255)                   null
 * <br/>    );
 * <br/>    comment on table LacSuitTaskParam is'适配任务参数';
 * <br/>    comment on column LacSuitTaskParam.suitTaskId is'适配任务id';
 * <br/>    comment on column LacSuitTaskParam.suitTaskName is'适配任务名称';
 * <br/>    comment on column LacSuitTaskParam.suitTaskCode is'适配任务代码';
 * <br/>    comment on column LacSuitTaskParam.paramName is'参数名称';
 * <br/>    comment on column LacSuitTaskParam.paramType is'参数类型(枚举)';
 * <br/>    comment on column LacSuitTaskParam.paramValueType is'参数值类型(枚举)';
 * <br/>    comment on column LacSuitTaskParam.defaultValue is'默认值';
 * <br/>    comment on column LacSuitTaskParam.paramDescrition is'参数描述';
 * </per>
 * @Reference :
 * @Author : wei.peng
 * @CreateDate : 19-10-25 下午6:49
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="LAC_SUIT_TASK_PARAM")
@Api(value="调度任务参数",description = "调度任务参数信息")
public class LacSuitTaskParam extends BaseBean {

    private static final long serialVersionUID = 3521650869017242460L;
    @Column(name="TASK_ID")
    @ApiParam(value ="任务ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long taskId;

    @Column(name="TASK_NAME_RDD")
    @ApiParam(value ="任务名称")
    private String taskNameRdd;

    @Column(name="TASK_CODE_RDD")
    @ApiParam(value ="任务代码")
    private String taskCodeRdd;

    @Column(name="PARAM_NAME")
    @ApiParam(value ="参数名称")
    private String paramName;

    @Column(name="PARAM_CODE")
    @ApiParam(value ="参数编码")
    private String paramCode;

    @Column(name="PARAM_TYPE")
    @ApiParam(value ="参数类型")
    @AnnoOutputColumn(refClass = LacEnumUtil.PARAM_TYPE.class)
    private Integer paramType;

    @Column(name="PARAM_VALUE_TYPE")
    @ApiParam(value ="参数值类型")
    @AnnoOutputColumn(refClass = LacEnumUtil.PARAM_VALUE_TYPE.class)
    private Integer paramValueType;

    @Column(name="PARAM_DEFAULT_VALUE")
    @ApiParam(value ="参数默认值")
    private String paramDefaultValue;

    @Column(name="PARAM_DESCRIPTION")
    @ApiParam(value ="参数描述")
    private String paramDescription;

    @Transient
    @ApiParam(value ="参数值")
    private Object value;

    public String getValueStr() {
        if (value == null) {
            return null;
        }
        return value.toString();
    }
}
