package com.ruoyi.workflow.domain;

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 工作流实例对象 dc_workflow_instance
 * 
 * @author ruoyi
 * @date 2025-12-19
 */
public class WorkflowInstance extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 工作流实例ID */
    private Long instanceId;

    /** 工作流定义ID */
    @Excel(name = "工作流定义ID")
    @NotNull(message = "工作流定义ID不能为空")
    private Long definitionId;

    /** 实例名称 */
    @Excel(name = "实例名称")
    @NotBlank(message = "实例名称不能为空")
    private String instanceName;

    /** 业务键 */
    @Excel(name = "业务键")
    private String businessKey;

    /** 启动用户ID */
    @Excel(name = "启动用户ID")
    private Long startUserId;

    /** 启动用户名 */
    @Excel(name = "启动用户名")
    private String startUserName;

    /** 实例状态(RUNNING运行中 COMPLETED已完成 SUSPENDED暂停 TERMINATED终止) */
    @Excel(name = "实例状态")
    private String instanceStatus;

    /** 当前节点 */
    @Excel(name = "当前节点")
    private String currentNode;

    /** 启动时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "启动时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    /** 结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    /** 持续时间(毫秒) */
    @Excel(name = "持续时间")
    private Long duration;

    /** 实例变量JSON */
    private String variablesJson;

    /** 优先级 */
    @Excel(name = "优先级")
    private Integer priority;

    /** 父实例ID */
    private Long parentInstanceId;

    public void setInstanceId(Long instanceId) 
    {
        this.instanceId = instanceId;
    }

    public Long getInstanceId() 
    {
        return instanceId;
    }

    public void setDefinitionId(Long definitionId) 
    {
        this.definitionId = definitionId;
    }

    public Long getDefinitionId() 
    {
        return definitionId;
    }

    public void setInstanceName(String instanceName) 
    {
        this.instanceName = instanceName;
    }

    public String getInstanceName() 
    {
        return instanceName;
    }

    public void setBusinessKey(String businessKey) 
    {
        this.businessKey = businessKey;
    }

    public String getBusinessKey() 
    {
        return businessKey;
    }

    public void setStartUserId(Long startUserId) 
    {
        this.startUserId = startUserId;
    }

    public Long getStartUserId() 
    {
        return startUserId;
    }

    public void setStartUserName(String startUserName) 
    {
        this.startUserName = startUserName;
    }

    public String getStartUserName() 
    {
        return startUserName;
    }

    public void setInstanceStatus(String instanceStatus) 
    {
        this.instanceStatus = instanceStatus;
    }

    public String getInstanceStatus() 
    {
        return instanceStatus;
    }

    public void setCurrentNode(String currentNode) 
    {
        this.currentNode = currentNode;
    }

    public String getCurrentNode() 
    {
        return currentNode;
    }

    public void setStartTime(Date startTime) 
    {
        this.startTime = startTime;
    }

    public Date getStartTime() 
    {
        return startTime;
    }

    public void setEndTime(Date endTime) 
    {
        this.endTime = endTime;
    }

    public Date getEndTime() 
    {
        return endTime;
    }

    public void setDuration(Long duration) 
    {
        this.duration = duration;
    }

    public Long getDuration() 
    {
        return duration;
    }

    public void setVariablesJson(String variablesJson) 
    {
        this.variablesJson = variablesJson;
    }

    public String getVariablesJson() 
    {
        return variablesJson;
    }

    public void setPriority(Integer priority) 
    {
        this.priority = priority;
    }

    public Integer getPriority() 
    {
        return priority;
    }

    public void setParentInstanceId(Long parentInstanceId) 
    {
        this.parentInstanceId = parentInstanceId;
    }

    public Long getParentInstanceId() 
    {
        return parentInstanceId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("instanceId", getInstanceId())
            .append("definitionId", getDefinitionId())
            .append("instanceName", getInstanceName())
            .append("businessKey", getBusinessKey())
            .append("startUserId", getStartUserId())
            .append("startUserName", getStartUserName())
            .append("instanceStatus", getInstanceStatus())
            .append("currentNode", getCurrentNode())
            .append("startTime", getStartTime())
            .append("endTime", getEndTime())
            .append("duration", getDuration())
            .append("variablesJson", getVariablesJson())
            .append("priority", getPriority())
            .append("parentInstanceId", getParentInstanceId())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}