package com.qqchen.deploy.backend.workflow.service;

import com.qqchen.deploy.backend.framework.service.IBaseService;
import com.qqchen.deploy.backend.workflow.dto.WorkflowNodeInstanceDTO;
import com.qqchen.deploy.backend.workflow.dto.query.WorkflowNodeInstanceQuery;
import com.qqchen.deploy.backend.workflow.entity.WorkflowNodeInstance;
import com.qqchen.deploy.backend.workflow.enums.WorkflowNodeInstanceStatusEnums;
import com.qqchen.deploy.backend.workflow.dto.event.WorkflowNodeInstanceStatusChangeEvent;

import java.util.List;

public interface IWorkflowNodeInstanceService extends IBaseService<WorkflowNodeInstance, WorkflowNodeInstanceDTO, WorkflowNodeInstanceQuery, Long> {
    /**
     * 更新节点实例状态
     *
     * @param processInstanceId 流程实例ID
     * @param executionId      执行ID
     * @param status          状态
     * @return 更新后的节点实例
     */
    WorkflowNodeInstance updateNodeStatus(String processInstanceId, String executionId, WorkflowNodeInstanceStatusEnums status);

    /**
     * 获取流程实例的所有节点
     *
     * @param processInstanceId 流程实例ID
     * @return 节点列表
     */
    List<WorkflowNodeInstanceDTO> getNodesByProcessInstanceId(String processInstanceId);

    void saveOrUpdateWorkflowNodeInstance(WorkflowNodeInstanceStatusChangeEvent event);
}
