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

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import lombok.Data;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

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

/**
 * 脚本持久化历史记录
 *
 * @author jason.niu
 * @since 2020-04-29
 */
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "SCRIPT_PERSISTENCE_HISTORY")
@Api("系统动态脚本")
public class EngineScriptPersistenceHistory extends BaseBean {

    private static final long serialVersionUID = 7201021903118622899L;
    // 脚本调用的唯一编号，例如：WMS_PDA_0001
    @Column(name = "SCRIPT_NO", length = 50)
    private String scriptNo;

    // 脚本的中文名称
    @Column(name = "SCRIPT_NAME", length = 50)
    private String scriptName;

    // 10=组件脚本，20=表单脚本，30=报表脚本，40=JOB脚本，50=其他脚本
    @Column(name = "SCRIPT_TYPE")
    private Integer scriptType;

    // 脚本编写的语言
    // 10=Groovy, 20=Jython, 30=JavaScript, 40=Scala, 50=JRuby
    @Column(name = "LANGUAGE_TYPE")
    private Integer languageType;

    // 脚本的具体内容
    @Lob
    @Column(name = "SCRIPT_CONTENT", columnDefinition = "TEXT")
    private String scriptContent;

    // 脚本的描述，包含脚本的用法，参数说明等
    @Column(name = "SCRIPT_REMARK", length = 2000)
    private String scriptRemark;

    // 编译后的脚本内容，通过预编译加快脚本的运行速度
    @Transient
    private Object compiledScript;

}
