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


import cn.edu.whu.boot.allocation.entities.TaskCellData;
import cn.edu.whu.boot.xml.domain.Task;
import cn.edu.whu.boot.xml.xmlreader.bean.Table;

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

public interface TaskCellDataService {
    Optional<TaskCellData> findById(int id);

    List<TaskCellData> findByTaskId(int taskId);

    List<TaskCellData> findByTaskIdAndGeohash(int taskId , String cellGeohash);

    List<TaskCellData> findByTaskIdAndTableNameAndGeohash(int taskId , String tableName, String cellGeohash);

    Optional<TaskCellData> findByTaskIdAndTableNameAndDataId(int taskId , String tableName , long dataId);

    List<TaskCellData> findByTaskIdAndCellGeohashIn(int taskId , List<String> cellGeohashes);

    int insert(TaskCellData taskCellData);

    void insertList(List<TaskCellData> taskCellDataList);

    void deleteByTaskId(int taskId);

    List<TaskCellData> findTaskDataInTheSameCell(int taskId, long dataId);

    List<String> findCellGeohashByData(int taskId, String tableName, List<Long> dataIds);

    void updateAfterDataCreatedOrUpdated(Task task, Table table, long dataId);

    List<String> findCellsWhereUserIsAbsent(int taskId, String table, Integer reviewerId, List<Long> dataIds);
}
