package com.ssj.service.kmt.service;

import com.ssj.bean.kmt.kmt.domain.KmtHomeworkWrongQuestion;
import com.ssj.bean.sys.homework.domain.Homework;
import com.ssj.framework.core.common.service.BaseService;
import com.ssj.service.kmt.dto.OriginalQuestionDTO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

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

public interface KmtHomeworkWrongQuestionService extends BaseService<KmtHomeworkWrongQuestion, String> {

    /**
     * 根据作业图片的id查询错题
     */
    List<KmtHomeworkWrongQuestion> findList(String homeworkPictureId, boolean isDelete);

    /**
     * 根据作业id集合查询错题和未完成的题目
     */
    List<KmtHomeworkWrongQuestion> findByHomeworkId(String homeworkId);

    /**
     * 删除批改的对错题
     * @param homeworkPictureId
     */
    void deleteByHomeworkPictureId (String homeworkPictureId);

    /**
     * 分页查询错题列表
     */
    Page<Map<String, Object>> findWrongQuestionByPage(Map<String, Object> searchParams, Pageable pageable);

    /**
     * 分页查询错题列表(新)
     */
    Page<Map<String, Object>> findWrongQuestionNewByPage(Map<String, Object> searchParams, Pageable pageable);

    /**
     * new一个KmtHomeworkWrongQuestion对象用于作业批改
     * @param homework 作业
     * @param now 时间
     * @param questionId 关联的题目id
     * @param wrongType 错误的类型，参考com.ssj.service.kmt.enums.HomeworkWrongQuestionTypeEnum
     */
    KmtHomeworkWrongQuestion createKmtHomeworkWrongQuestion(Homework homework, Date now, String questionId, Integer wrongType);

    /**
     * 根据作业图片的id列表查询批改的题目
     */
    List<KmtHomeworkWrongQuestion> findByHomeworkPictureIdIn(List<String> homeworkPictureIdList);

    /**
     * 错题本错题删除
     * @param questionId
     */
    void deleteWrongQuesByQuestionId(String questionId);

    /**
     * 根据图片id查询对应的题库原题
     */
    List<Map<String, Object>> findQuestionList(List<String> homeworkPictureIdList);

    /**
     * 根据图片id查询对应的题库原题(包括所属大题及大题下所有小题)
     * @return
     */
    List<OriginalQuestionDTO> findQuestionContainParentAndBrotherList(List<String> homeworkPictureIdList);

    /**
     * 查询出指定小题对应的整个大题
     * @param questionId 小题id
     * @return
     */
    List<Map<String, Object>> findFullBigQuestion(String questionId);
}