package com.kgraph.graph.domain;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.kgraph.common.annotation.Excel;
import com.kgraph.common.core.domain.BaseEntity;

/**
 * 任务管理对象 biz_task
 * 
 * @author Allen
 * @date 2023-10-16
 */
public class Task extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    private Long id;

    /** 源文件id */
    @Excel(name = "任务名称")
    private String taskName;

    /** 任务名称 */
    @Excel(name = "任务类型")
    private String taskType;

    /** 子任务 */
    @Excel(name = "子任务")
    private String subtask;

    /** 使用subtask */
    @Deprecated
    private String subtaskArray;

    /** 任务状态 */
    @Excel(name = "任务状态")
    private String taskStatus;

    /** 源文件id */
    @Excel(name = "源文件id")
    private Long relateSourceFileId;

    /** 处理文件id */
    @Excel(name = "处理文件id")
    private Long relateProcessedFileId;

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

    public Long getId() 
    {
        return id;
    }
    public void setTaskName(String taskName) 
    {
        this.taskName = taskName;
    }

    public String getTaskName() 
    {
        return taskName;
    }
    public void setTaskType(String taskType) 
    {
        this.taskType = taskType;
    }

    public String getTaskType() 
    {
        return taskType;
    }
    public void setSubtask(String subtask) 
    {
        this.subtask = subtask;
    }

    public String getSubtask() 
    {
        return subtask;
    }
    public void setTaskStatus(String taskStatus) 
    {
        this.taskStatus = taskStatus;
    }

    public String getTaskStatus() 
    {
        return taskStatus;
    }
    public void setRelateSourceFileId(Long relateSourceFileId) 
    {
        this.relateSourceFileId = relateSourceFileId;
    }

    public Long getRelateSourceFileId() 
    {
        return relateSourceFileId;
    }
    public void setRelateProcessedFileId(Long relateProcessedFileId) 
    {
        this.relateProcessedFileId = relateProcessedFileId;
    }

    public Long getRelateProcessedFileId() 
    {
        return relateProcessedFileId;
    }

    public String[] getSubtaskArray() {
        if (StringUtils.isNotEmpty(subtask)) {
            return subtask.split(",");
        } else {
            return new String[0];
        }
    }

    public void setSubtaskArray(String[] subtaskArray) {
        if (subtaskArray != null) {
            subtask = String.join(",", subtaskArray);
        } else {
            subtask = "";
        }
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("taskName", getTaskName())
            .append("taskType", getTaskType())
            .append("subtask", getSubtask())
            .append("taskStatus", getTaskStatus())
            .append("relateSourceFileId", getRelateSourceFileId())
            .append("relateProcessedFileId", getRelateProcessedFileId())
            .append("remark", getRemark())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
