package com.qmth.teachcloud.common.bean.result;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.teachcloud.common.enums.TaskResultEnum;
import com.qmth.teachcloud.common.enums.TaskStatusEnum;
import com.qmth.teachcloud.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;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "印刷计划id")
    Long printPlanId;

    @ApiModelProperty(value = "学校名称")
    String printPlanName;

    @ApiModelProperty(value = "任务类型，IMPORT_STUDENT_PHOTO：照片导入，EXPORT_STUDENT_PHOTO：照片导出，IMPORT_EXAM_STUDENT：考生导入，EXPORT_EXAM_STUDENT：考生导出，IMPORT_BATCH_PAPER：试卷批量导入，EXPORT_BATCH_PAPER：试卷批量导出，IMPORT_CUSTOM_TEMPLATE：模版批量导入，EXPORT_CUSTOM_TEMPLATE：模版批量导出，DOWNLOAD_BOX_STICKER：箱贴下载")
    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 = "是否有导出文件")
    Boolean hasResultFile;

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

    @ApiModelProperty(value = "是否重新生成pdf")
    boolean resetCreatePdf;

    @ApiModelProperty(value = "重新生成次数")
    int resetCount;

    @ApiModelProperty(value = "人工错误原因")
    String errorMessage;

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public int getResetCount() {
        return resetCount;
    }

    public void setResetCount(int resetCount) {
        this.resetCount = resetCount;
    }

    public boolean isResetCreatePdf() {
        return resetCreatePdf;
    }

    public void setResetCreatePdf(boolean resetCreatePdf) {
        this.resetCreatePdf = resetCreatePdf;
    }

    public Long getId() {
        return id;
    }

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

    public Long getPrintPlanId() {
        return printPlanId;
    }

    public void setPrintPlanId(Long printPlanId) {
        this.printPlanId = printPlanId;
    }

    public String getPrintPlanName() {
        return printPlanName;
    }

    public void setPrintPlanName(String printPlanName) {
        this.printPlanName = printPlanName;
    }

    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 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;
    }
}
