package com.qmth.paper.library.common.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.paper.library.common.base.BaseEntity;
import com.qmth.paper.library.common.contant.SystemConstant;
import com.qmth.paper.library.common.enums.TaskResultEnum;
import com.qmth.paper.library.common.enums.TaskStatusEnum;
import com.qmth.paper.library.common.enums.TaskTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * <p>
 * 导入导出任务表
 * </p>
 *
 * @author wangliang
 * @since 2021-03-19
 */
@ApiModel(value = "TBTask对象", description = "异步操作任务表")
public class TBTask extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "学校id")
    @TableField(value = "school_id")
    private Long schoolId;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "考试id")
    @TableField(value = "exam_id")
    private Long examId;

    @ApiModelProperty(value = "任务类型")
    @TableField(value = "type")
    private TaskTypeEnum type;

    @ApiModelProperty(value = "任务状态，INIT：未开始，RUNNING：进行中，FINISH：已完成")
    @TableField(value = "status")
    private TaskStatusEnum status;

    @ApiModelProperty(value = "实时摘要信息")
    @TableField(value = "summary")
    private String summary;

    @ApiModelProperty(value = "数据结果，SUCCESS：成功，ERROR：失败")
    @TableField(value = "result")
    private TaskResultEnum result;

    @ApiModelProperty(value = "导入文件名")
    @TableField(value = "import_file_name", updateStrategy = FieldStrategy.IGNORED)
    private String importFileName;

    @ApiModelProperty(value = "导入文件路径")
    @TableField(value = "import_file_path", updateStrategy = FieldStrategy.IGNORED)
    private String importFilePath;

    @ApiModelProperty(value = "导出文件路径")
    @TableField(value = "export_file_path")
    private String exportFilePath;

    @ApiModelProperty(value = "错误文件路径")
    @TableField(value = "error_file_path")
    private String errorFilePath;

    @ApiModelProperty(value = "备注")
    @TableField(value = "remark")
    private String remark;

    public TBTask() {

    }

    public TBTask(TaskTypeEnum type, TaskStatusEnum status, String summary, String importFileName, String importFilePath, Long createId, Long schoolId) {
        setId(SystemConstant.getDbUuid());
        this.type = type;
        this.status = status;
        this.summary = summary;
        this.importFileName = importFileName;
        this.importFilePath = importFilePath;
        setCreateId(createId);
        setCreateTime(System.currentTimeMillis());
        this.schoolId = schoolId;
    }

    public TBTask(TaskTypeEnum type, TaskStatusEnum status, String importFileName, String importFilePath, Long createId, Long schoolId) {
        setId(SystemConstant.getDbUuid());
        this.type = type;
        this.status = status;
        this.importFileName = importFileName;
        this.importFilePath = importFilePath;
        setCreateId(createId);
        setCreateTime(System.currentTimeMillis());
        this.schoolId = schoolId;
    }

    public Long getSchoolId() {
        return schoolId;
    }

    public void setSchoolId(Long schoolId) {
        this.schoolId = schoolId;
    }

    public Long getExamId() {
        return examId;
    }

    public void setExamId(Long examId) {
        this.examId = examId;
    }

    public TaskTypeEnum getType() {
        return type;
    }

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

    public TaskStatusEnum getStatus() {
        return status;
    }

    public void setStatus(TaskStatusEnum status) {
        this.status = status;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public TaskResultEnum getResult() {
        return result;
    }

    public void setResult(TaskResultEnum result) {
        this.result = result;
    }

    public String getImportFileName() {
        return importFileName;
    }

    public void setImportFileName(String importFileName) {
        this.importFileName = importFileName;
    }

    public String getImportFilePath() {
        return importFilePath;
    }

    public void setImportFilePath(String importFilePath) {
        this.importFilePath = importFilePath;
    }

    public String getExportFilePath() {
        return exportFilePath;
    }

    public void setExportFilePath(String exportFilePath) {
        this.exportFilePath = exportFilePath;
    }

    public String getErrorFilePath() {
        return errorFilePath;
    }

    public void setErrorFilePath(String errorFilePath) {
        this.errorFilePath = errorFilePath;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
