package cn.edu.whu.boot.allocation.services;


import cn.edu.whu.boot.allocation.controllers.dtos.Worker;
import cn.edu.whu.boot.allocation.entities.TaskUserRole;

import java.util.List;
import java.util.Optional;

public interface TaskUserRoleService {

    TaskUserRole findById(int id);

    List<TaskUserRole> findByTaskId(int taskId);

    List<TaskUserRole> findByUserId(int userId);

    List<Worker> findWorkerByTaskId(int taskId);

    Optional<Integer> findWorkRoleByTaskIdAndUserId(int taskId, int userId);

    void insertList(List<TaskUserRole> list);

    TaskUserRole update(TaskUserRole taskUserRole);

    /**
     * 在task_user_role表中获取某任务下的所有工作人员的userId
     */
    List<Integer> getUserIdByTaskId(int taskId);

    void deleteByTaskId(int taskId);

    void deleteByTaskIdAndUserId(int taskId, int userId);
}
