package org.springblade.etl.entity;

import java.time.LocalDateTime;
import java.util.Date;

import org.springblade.core.mp.base.TenantEntity;
import org.springblade.etl.enums.InstanceRunType;
import org.springblade.etl.enums.InstanceStatus;
import org.springblade.etl.enums.InstanceType;
import org.springframework.format.annotation.DateTimeFormat;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 任务实例表 etl_job_instance
 * 
 * @author aokunsang
 * @date 2023-07-28
 */
@Data
@TableName("etl_job_instance")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "JobInstance对象", description = "任务实例")
public class JobInstance extends TenantEntity{

	private static final long serialVersionUID = 1L;
	
 	/** 
	 *  
	 */
	@TableId(type = IdType.AUTO)
	private Integer id;

	/** 
	 * 任务ID 
	 */
	@ApiModelProperty(value = "任务ID")
	private Integer jobId;

	/** 
	 * 计算引擎的作业ID 
	 */
	@ApiModelProperty(value = "计算引擎的作业ID")
	private String jobEngineId;

	/** 
	 * flink的web地址 
	 */
	@ApiModelProperty(value = "flink的web地址")
	private String webInterfaceUrl;

	/** 
	 * Flink application id 
	 */
	@ApiModelProperty(value = "Flink application id")
	private String applicationId;

	/** 
	 * 作业类型(流作业 批作业) 
	 */
	@ApiModelProperty(value = "作业类型(流作业 批作业)")
	private InstanceType instanceType;

	/** 
	 * 任务执行状态(运行中 成功 失败 中断) 
	 */
	@ApiModelProperty(value = "作业状态(运行中 成功 失败 中断)")
	private InstanceStatus instanceStatus;
	
	/**
	 * 
	 */
	@ApiModelProperty(value = "作业运行类型(手动 自动)")
	private InstanceRunType instanceRunType;

	/** 
	 * 开始时间 
	 */
	@ApiModelProperty(value = "开始时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@TableField(whereStrategy = FieldStrategy.NEVER)
	private Date startTime;

	/** 
	 * 结束时间 
	 */
	@ApiModelProperty(value = "结束时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@TableField(whereStrategy = FieldStrategy.NEVER)
	private Date endTime;

	/** 
	 * 创建时间 
	 */
	@ApiModelProperty(value = "创建时间")
	private LocalDateTime createTime;
	
	/**
	 * 
	 */
	@ApiModelProperty(value = "错误描述")
	private String errMsg;
	
	/** 
	 * 计算引擎中作业状态
	 */
	@ApiModelProperty(value = "计算引擎中作业状态")
	private String engineJobStatus;
	
	/** 
	 * 读取数据记录数 
	 */
	@ApiModelProperty(value = "读取数据记录数")
	private Long readRowCount;

	/** 
	 * 写入数据记录数 
	 */
	@ApiModelProperty(value = "写入数据记录数")
	private Long writeRowCount;

	/** 
	 * 读取的qps 
	 */
	@ApiModelProperty(value = "读取的qps")
	private Long readQps;

	/** 
	 * 写入的qps 
	 */
	@ApiModelProperty(value = "写入的qps")
	private Long writeQps;
	
	
	@ApiModelProperty(value = "任务名称[仅用于展示]")
	@TableField(exist = false)
	private String jobName;
}
