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

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

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

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<MarkConfigItem> 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 updateSheetView(int examId, String subjectCode, Integer number, boolean sheetView);

    void updateEnableAllZero(int examId, String subjectCode, Integer number, boolean enableAllZero);

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

    List<Integer> findExamIdByStatus(ExamStatus examStatus, MarkStatus... markStatus);

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

    long countByExamAndSubjectAndStatus(Integer examId, String subjectCode, MarkStatus... status);

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

    int findMaxNumberByExamIdAndSubjectCode(int examId, String subjectCode);

    List<MarkGroup> findByExamAndSubjectAndSelective(Integer examId, String subjectCode, boolean selective);

}
