package cn.stylefeng.workflow.instance.modular.task.service;

import cn.stylefeng.team.project.api.pojo.BusinessRenderDetailVo;
import cn.stylefeng.workflow.api.entity.design.Node;
import cn.stylefeng.workflow.api.entity.instance.RuntimeNode;
import cn.stylefeng.workflow.api.entity.task.RuTask;
import cn.stylefeng.workflow.api.enums.TaskStatusEnum;
import cn.stylefeng.workflow.api.enums.TaskTypeEnum;
import cn.stylefeng.workflow.api.pojo.InstanceContext;
import cn.stylefeng.workflow.api.pojo.config.node.button.NodeButtonPermission;
import cn.stylefeng.workflow.design.api.callback.ModelRemoveCallback;
import cn.stylefeng.workflow.instance.api.TaskApi;
import cn.stylefeng.workflow.instance.api.pojo.task.RuTaskRequest;
import cn.stylefeng.workflow.instance.modular.task.pojo.NodeTaskCountVo;
import cn.stylefeng.workflow.instance.modular.task.pojo.TaskDetailVo;
import cn.stylefeng.workflow.instance.modular.task.pojo.ToDoNumberVo;
import cn.stylefeng.workflow.instance.modular.task.pojo.TotalTaskNumberVo;
import cn.stylefeng.workflow.instance.modular.task.pojo.request.TaskButtonPermissionRequest;
import cn.stylefeng.workflow.instance.modular.task.pojo.request.TaskFormDataRequest;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

public interface RuTaskService extends IService<RuTask>, TaskApi, ModelRemoveCallback {

    void createNodeTask(Node node, TaskTypeEnum taskTypeEnum, RuntimeNode runtimeNode, InstanceContext instanceContext);

    void createWaitToDoTask(Node node, RuntimeNode runtimeNode, InstanceContext instanceContext);

    void createWaitToReadTask(Node node, RuntimeNode runtimeNode, InstanceContext instanceContext);

    void createWaitToHandleTask(Node node, RuntimeNode runtimeNode, InstanceContext instanceContext);

    void createUserTask(Long approverId, TaskTypeEnum taskTypeEnum, RuntimeNode runtimeNode, InstanceContext instanceContext);

    RuTask detail(RuTaskRequest ruTaskRequest);

    List<RuTask> findList(RuTaskRequest ruTaskRequest);

    ToDoNumberVo getUserWaitToTaskNum(RuTaskRequest ruTaskRequest);

    void deleteAnyOtherTask(Long ruNodeId, Long taskId);

    void deleteAnyOtherTask(boolean canDelete, Long ruNodeId, Long taskId);

    void deleteInstanceProcessingTask(Long instanceId);

    List<RuntimeNode> getBackReNodeList(RuTaskRequest ruTaskRequest);

    NodeButtonPermission getTaskButtonPermission(TaskButtonPermissionRequest taskButtonPermissionRequest);

    BusinessRenderDetailVo getTaskFormData(TaskFormDataRequest taskFormDataRequest);

    NodeTaskCountVo getNodeTaskCount(Long ruNodeId);

    Integer getTaskNodeApproverNodeType(RuTaskRequest ruTaskRequest);

    List<RuTask> findListByRuNodeIds(List<Long> ruNodeIdList, TaskStatusEnum taskStatusEnum);

    TotalTaskNumberVo getUserTotalTaskNum(RuTaskRequest ruTaskRequest);

    TaskDetailVo getTaskDetail(RuTaskRequest ruTaskRequest);

    List<RuTask> getInstanceIdRunningTask(Long instanceId);

}