package ink.wgink.module.examine.service.question;

import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SearchException;
import ink.wgink.module.examine.enums.question.QuestionChoiceTypeEnum;
import ink.wgink.module.examine.enums.question.QuestionTypeEnum;
import ink.wgink.module.examine.pojo.dtos.question.QuestionDTO;
import ink.wgink.module.examine.pojo.vos.question.QuestionVO;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList;

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

/**
 * @ClassName: IQuestionService
 * @Description: 试题管理
 * @Author: WenG
 * @Date: 2020-09-09 21:00
 * @Version: 1.0
 **/
public interface IQuestionService {

    /**
     * 新增试题管理
     *
     * @param questionVO
     * @return
     * @throws Exception
     */
    void save(QuestionVO questionVO) throws Exception;

    /**
     * @return
     * @throws Exception
     */
    void saveByToken(String token, QuestionVO questionVO) throws Exception;

    /**
     * 新增试题管理
     *
     * @param questionVO
     * @return questionId
     * @throws Exception
     */
    String saveReturnId(QuestionVO questionVO) throws Exception;

    /**
     * 新增试题管理(APP)
     *
     * @param token
     * @param questionVO
     * @return questionId
     * @throws Exception
     */
    String saveByTokenReturnId(String token, QuestionVO questionVO) throws Exception;

    /**
     * 删除试题管理
     *
     * @param ids
     * @return
     * @throws RemoveException
     */
    void remove(List<String> ids) throws RemoveException;

    /**
     * 删除试题管理（物理删除）
     *
     * @param ids
     * @throws RemoveException
     */
    void delete(List<String> ids) throws RemoveException;

    /**
     * 删除试题管理(APP)
     *
     * @param token
     * @param ids
     * @return
     * @throws RemoveException
     */
    void removeByToken(String token, List<String> ids) throws RemoveException;

    /**
     * 修改试题管理
     *
     * @param questionId
     * @param questionVO
     * @return
     * @throws Exception
     */
    void update(String questionId, QuestionVO questionVO) throws Exception;

    /**
     * 修改试题管理(APP)
     *
     * @param token
     * @param questionId
     * @param questionVO
     * @return
     * @throws Exception
     */
    void updateByToken(String token, String questionId, QuestionVO questionVO) throws Exception;

    /**
     * 试题管理详情(通过ID)
     *
     * @param questionId
     * @return
     * @throws SearchException
     */
    QuestionDTO getById(String questionId) throws SearchException;

    /**
     * 试题管理列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<QuestionDTO> list(Map<String, Object> params) throws SearchException;

    /**
     * 试题列表
     *
     * @param questionIds
     * @return
     */
    List<QuestionDTO> listByIds(List<String> questionIds);

    /**
     * 试题管理分页列表
     *
     * @param page
     * @return
     * @throws SearchException
     */
    SuccessResultList<List<QuestionDTO>> listPage(ListPage page) throws SearchException;

    /**
     * 试题管理统计
     *
     * @param params
     * @return
     * @throws SearchException
     */
    Integer count(Map<String, Object> params) throws SearchException;

    /**
     * 随机试题ID
     *
     * @param randomCount
     * @param questionTypeEnum
     * @param questionChoiceTypeEnum
     * @return
     */
    List<String> listRandomIdByRandomCountAndTypeAndChoiceType(int randomCount, QuestionTypeEnum questionTypeEnum, QuestionChoiceTypeEnum questionChoiceTypeEnum);

}