package cn.axzo.workflow.core.service;

import cn.axzo.workflow.common.model.dto.es.HistoricProcessInstanceSearchForEsDTO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.engine.history.HistoricProcessInstance;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 专用与对接 ES 的流程实例相关操作
 *
 * @author wangli
 * @since 2024-09-27 14:23
 */
public interface BpmnProcessInstanceForEsService {

    Long queryHistoricProcessInstanceTotalCount(HistoricProcessInstanceSearchForEsDTO search);

    List<HistoricProcessInstance> queryHistoricProcessInstance(HistoricProcessInstanceSearchForEsDTO search, IPage page);

    BpmnModel queryBpmnModel(String processDefinitionId);

    Map<String, Object> queryInstanceVariables(String processInstanceId, List<String> variableNames);

    Long queryHistoricProcessInstanceByUnfinishedAndAlterEndTimeTotalCount(Date endTime);

    /**
     * 查询指定时间点之后的完成的审批,和还未完成的审批
     * @param endTime
     * @param page
     * @return
     */
    List<HistoricProcessInstance> queryHistoricProcessInstanceByUnfinishedAndAlterEndTime(Date endTime, IPage page);
}
