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


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

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

public interface TaskUserCellService {
    Optional<TaskUserCell> findById(int id);

    List<TaskUserCell> findByTaskIdAndUserId(int taskId, int userId);

    List<Worker> findWorkerByTaskId(int taskId);

    List<Worker> findWorkerByTaskIdAndUserId(int taskId, int userId);

    Optional<TaskUserCell> findByTaskIdAndUserIdAndCellGeohash(int taskId, int userId, String geohash);

    int countByTaskIdAndUserId(int taskId, int userId);

    int insert(TaskUserCell taskUserCell);

    void insertList(List<TaskUserCell> list);

    void updateUserIdByTaskIdAndCellGeohash(int taskId, Map<String, Integer> cellToWorker) throws Exception;

    void deleteByTaskId(int taskId);

    void deleteByTaskIdAndUserId(int taskId, int userId);

    void deleteByTaskIdAndCellGeohashAndUserId(int taskId, String geohash, int userId);

    void deleteByTaskIdAndCellGeohash(int taskId, String geohash);
}
