package cn.com.qmth.stmms.biz.mark.service;

import cn.com.qmth.stmms.biz.mark.model.MarkLibrary;
import cn.com.qmth.stmms.biz.mark.query.MarkLibrarySearchQuery;
import cn.com.qmth.stmms.common.enums.LibraryStatus;

import java.util.List;
import java.util.Set;

public interface MarkLibraryService {

    MarkLibrary findById(int id);

    List<MarkLibrary> findByStudentId(int studentId);

    long countByQuery(MarkLibrarySearchQuery query);

    MarkLibrarySearchQuery findByQuery(MarkLibrarySearchQuery query);

    List<MarkLibrary> findUnMarked(Integer examId, String subjectCode, Integer groupNumber, Integer markerId,
            Integer userId, boolean filterClass, int pageNumber, int pageSize, Set<LibraryStatus> statusSet);

    long countByExamAndSubjectAndGroupAndStatus(int examId, String subjectCode, int groupNumber,
            LibraryStatus... status);

    long countByMarker(int markerId);

    List<MarkLibrary> findByStudentAndGroup(int studentId, int groupNumber);

    List<MarkLibrary> findByStudentIdAndStatus(int studentId, LibraryStatus status);

    List<Object[]> findScoreCount(int examId, String subjectCode, Integer groupNumber, Integer id,
            LibraryStatus... status);

    List<Double> findScore(int examId, String subjectCode, Integer groupNumber, LibraryStatus... status);

    void save(List<MarkLibrary> libraryList);

    MarkLibrary save(MarkLibrary library);

    void releaseByLibrary(MarkLibrary library);

    void releaseByUserId(Integer examId, String subjectCode, Integer groupNumber, Integer userId);

    boolean hasApplied(MarkLibrary library, Integer userId);

    boolean applyLibrary(MarkLibrary library, Integer userId);

    Set<String> findSubjectUnFinishByExamId(int examId);

    long countByExamAndSubjectAndGroupAndFilterClass(Integer examId, String subjectCode, Integer groupNumber,
            Integer userId);

    long countMarkedByExamAndSubjectAndGroupAndFilterClass(Integer examId, String subjectCode, Integer groupNumber,
            Integer userId, LibraryStatus... status);

    MarkLibrarySearchQuery findHistory(MarkLibrarySearchQuery query);

}
