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

import java.util.Date;
import java.util.List;

import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
import cn.com.qmth.stmms.biz.mark.model.PictureConfigItem;
import cn.com.qmth.stmms.common.enums.MarkMode;
import cn.com.qmth.stmms.common.enums.MarkStatus;

public interface MarkGroupService {

    MarkGroup save(MarkGroup markGroup);

    MarkGroup findOne(int examId, String subjectCode, int number);

    long countByExamAndSubject(int examId, String subjectCode);

    List<MarkGroup> findByExam(int examId);

    List<MarkGroup> findByExamAndSubject(int examId, String code);

    List<MarkGroup> findByExamAndSubjectWithDouble(int examId, String code);

    long countByExam(int examId);

    void updatePicList(int examId, String subjectCode, int number, List<PictureConfigItem> picList);

    void updateBuildTime(int examId, String subjectCode, int number, Date time);

    void resetBuildTime(int examId, String subjectCode);

    void updateDoubleRate(int examId, String subjectCode, Integer number, Double doubleRate);

    void updateArbitrateThreshold(int examId, String subjectCode, Integer number, Double arbitrateThreshold);

    void updateMarkMode(int examId, String subjectCode, Integer number, MarkMode markMode);

    void updateTrialCount(int examId, String subjectCode, Integer number, Integer trialCount);

    void updateSheetView(int examId, String subjectCode, Integer number, boolean sheetView);

    long sumLibraryCount(Integer examId);

    long sumMarkedCount(Integer examId);

    double sumTotalScore(Integer examId, String subjectCode);

    boolean updateStatus(int examId, String subjectCode, Integer number, MarkStatus newStatus,
            MarkStatus... currentStatus);

    List<Integer> findExamIdByStatus(MarkStatus... status);

    List<MarkGroup> findByExamAndSubjectAndStatus(Integer examId, String subjectCode, MarkStatus... status);

    boolean needTrialLibrary(Integer examId, String subjectCode, Integer number);

    long countByExamAndStatus(Integer examId, MarkStatus... status);

    boolean validateStatus(Integer examId, String subjectCode, Integer number, MarkStatus status);

}
