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

import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
import cn.com.qmth.stmms.biz.exam.service.query.ExamQuestionSearchQuery;
import cn.com.qmth.stmms.common.enums.ObjectivePolicy;

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

public interface ExamQuestionService {

    ExamQuestion save(ExamQuestion question);

    ExamQuestion saveAndFlush(ExamQuestion question);

    void save(List<ExamQuestion> questionList);

    ExamQuestionSearchQuery findByQuery(ExamQuestionSearchQuery query);

    long countByQuery(ExamQuestionSearchQuery query);

    void updateMainTitle(Integer examId, String subjectCode, boolean objective, Integer mainNumber, String mainTitle);

    void deleteByExamAndSubjectAndObjective(Integer examId, String subjectCode, boolean objective);

    void deleteByExamAndSubjectAndObjectiveAndGroupNumber(Integer examId, String subjectCode, boolean objective,
            Integer groupNumber);

    List<ExamQuestion> findByExamAndSubjectAndObjective(Integer examId, String subjectCode, boolean objective);

    List<ExamQuestion> findByExamAndSubjectAndObjectiveGroupByNumber(Integer examId, String subjectCode,
            boolean objective);

    List<ExamQuestion> findByExamAndSubjectAndObjectiveAndPaperType(Integer examId, String subjectCode,
            boolean objective, String paperType);

    List<String> getPaperType(int examId, String subjectCode);

    long countByExamAndSubjectAndObjectiveAndMainNumber(Integer examId, String subjectCode, boolean objective,
            Integer mainNumber);

    List<ExamQuestion> findByExamAndSubjectAndObjectiveAndGroupNumber(Integer examId, String subjectCode,
            boolean objective, Integer groupNumber);

    List<ExamQuestion> findByExamAndSubjectAndObjectiveAndGroupNumberNotEqual(Integer examId, String subjectCode,
            boolean objective, Integer groupNumber);

    List<ExamQuestion> findByExamAndSubjectAndObjectiveAndMainNumber(Integer examId, String subjectCode,
            boolean objective, Integer mainNumber);

    long countByExamAndSubjectAndObjectiveAndGroupNumber(int examId, String subjectCode, boolean objective,
            Integer groupNumber);

    long countByExamAndSubjectAndObjectiveAndMainNumberAndPaperType(Integer examId, String subjectCode,
            boolean objective, Integer mainNumber, String paperType);

    long countByExamAndSubjectAndObjectiveAndMainNumberAndSubNumber(Integer examId, String subjectCode,
            boolean objective, Integer mainNumber, String subNumber);

    ExamQuestion updateObjectivePolicy(Integer questionId, ObjectivePolicy objectivePolicy);

    ExamQuestion findById(Integer questionId);

    ExamQuestion findByExamAndSubjectAndObjectiveAndMainNumberAndSubNumber(Integer examId, String subjectCode,
            boolean objective, Integer mainNumber, String subNumber);

    List<ExamQuestion> findMainByExamAndSubjectAndObjective(Integer examId, String subjectCode, boolean objective);

    double sumTotalScore(int examId, String subjectCode, boolean objective);

    void deleteById(Integer questionId);

    long countByExamIdAndSubjectAndObjectiveAndGroupNumberIsNull(Integer examId, String subjectCode, boolean objective);

    Set<String> FindSubjectCodeByExamIdAndObjectiveAndGroupNumberIsNull(int examId, boolean objective);

    void resetByExamIdAndSubjectCodeAndObjectiveAndGroupNumber(Integer examId, String subjectCode, boolean objective,
            Integer number);

    double sumTotalScoreByGroupNumber(int examId, String subjectCode, boolean objective, Integer groupNumber);
}
