package com.qmth.sop.business.bean.result;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.sop.common.enums.TaskResultEnum;
import com.qmth.sop.common.enums.TaskStatusEnum;
import com.qmth.sop.common.enums.TaskTypeEnum;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Objects;

/**
 * @Description: 任务列表result
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2021/3/25
 */
public class TaskListResult implements Serializable {

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

    @ApiModelProperty(value = "任务类型")
    String type;

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

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

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "创建人id")
    Long createId;

    @ApiModelProperty(value = "创建人")
    String createName;

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

    @ApiModelProperty(value = "更新时间")
    Long updateTime;

    @ApiModelProperty(value = "是否有导入文件")
    Boolean hasImportFile;

    @ApiModelProperty(value = "是否有导出文件")
    Boolean hasResultFile;

    @ApiModelProperty(value = "是否有报告文件")
    Boolean hasReportFile;

    @ApiModelProperty(value = "下载文件类型")
    private String downloadType;

    public String getDownloadType() {
        return downloadType;
    }

    public void setDownloadType(String downloadType) {
        this.downloadType = downloadType;
    }

    public Long getId() {
        return id;
    }

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

    public String getType() {
        return TaskTypeEnum.valueOf(type).getTitle();
    }

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

    public String getStatus() {
        return Objects.nonNull(status) ? TaskStatusEnum.valueOf(status).getTitle() : status;
    }

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

    public String getResult() {
        return Objects.nonNull(result) ? TaskResultEnum.valueOf(result).getTitle() : null;
    }

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

    public Long getCreateId() {
        return createId;
    }

    public void setCreateId(Long createId) {
        this.createId = createId;
    }

    public String getCreateName() {
        return createName;
    }

    public void setCreateName(String createName) {
        this.createName = createName;
    }

    public Long getCreateTime() {
        return createTime;
    }

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

    public Long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    public Boolean getHasImportFile() {
        return hasImportFile;
    }

    public void setHasImportFile(Boolean hasImportFile) {
        this.hasImportFile = hasImportFile;
    }

    public Boolean getHasResultFile() {
        return hasResultFile;
    }

    public void setHasResultFile(Boolean hasResultFile) {
        this.hasResultFile = hasResultFile;
    }

    public Boolean getHasReportFile() {
        return hasReportFile;
    }

    public void setHasReportFile(Boolean hasReportFile) {
        this.hasReportFile = hasReportFile;
    }
}
