package com.ssj.service.kmt.service;

import com.ssj.bean.kmt.kmt.domain.KmtQualityQuestions;
import com.ssj.bean.kmt.kmt.request.exercise.KmtHandlingQuestionRequest;
import com.ssj.framework.core.common.service.BaseService;
import com.ssj.framework.core.security.exception.CommonException;
import com.ssj.framework.core.util.ResponseEntity;
import com.ssj.service.kmt.dto.ExerciseQuetionDto;
import com.ssj.service.kmt.dto.exercise.ExerciseQuestionRollbacks;
import com.ssj.service.kmt.request.AuditingRequest;
import com.ssj.service.kmt.request.KmtQuestionPublishRequest;
import com.ssj.service.kmt.request.KmtQuestionRollbackRequest;

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

public interface KmtQualityQuestionsService extends BaseService<KmtQualityQuestions, String> {

    /**
     * 查询kmt的题目 kmt_exercise_questions
     * @param request
     * @param userId
     * @return
     */
    Map<String, Object> getKmtHandlingQuestions (KmtHandlingQuestionRequest request, String userId);

    /**
     * 保存提交审核
     * @param request
     */
    ResponseEntity submitKmtQuestions2Auditing (AuditingRequest request, String userId);

    /**
     * 保存es实时更新
     * @param kmtExerciseQuestion
     */
    void save2EsImmediate(KmtQualityQuestions kmtExerciseQuestion);

    boolean saveToEs(KmtQualityQuestions kmtExerciseQuestion);


    /**
     * 删除题目
     * @param questionId
     */
    void deleteKmtQuestion (String questionId, String userId);

    /**
     * 查询所有大小题题目
     * @param parentIds
     * @return
     */
    ResponseEntity findQuestionListByParentId(List<String> parentIds);

    /**
     * kmt题目打回
     * @param userId
     * @param request
     * @return
     */
    ResponseEntity kmtQuestionRollback(String userId, KmtQuestionRollbackRequest request);

    /**
     * 发布kmt题目
     * @param request
     * @param userId
     * @return
     */
    ResponseEntity publishKmtQuestion(KmtQuestionPublishRequest request, String userId) throws CommonException;

    /**
     * es question 字段转义
     * @param list
     * @return
     */
    List<ExerciseQuetionDto> parseMapToExerciseQuestionList (List<Map> list);

    /**
     * 查询题库打回记录
     * @param questionId
     * @return
     */
    List<ExerciseQuestionRollbacks> findQuestionRollbackRecord (String questionId);
}
