package cn.com.qmth.examcloud.core.questions.dao;

import cn.com.qmth.examcloud.core.questions.base.enums.PaperStatus;
import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.repository.query.QueryByExampleExecutor;

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

public interface PaperRepo extends MongoRepository<Paper, String>, QueryByExampleExecutor<Paper> {

    List<Paper> findByParams(Map<String, String> params);

    Page<Paper> findByPaperType(PaperType paperType, Pageable pageable);

    Page<Paper> findByPaperStatus(PaperStatus paperStatus, Pageable pageable);

    List<Paper> findByNameAndOrgId(String name, String orgId);

    Page<Paper> findByIdNotInAndCourseNoAndOrgIdAndPaperType(Set<String> idSet, String courseNo, String orgId,
                                                             PaperType paperType, Pageable page);

    List<Paper> findByCourseNoAndOrgId(String courseNo, String orgId);

    List<Paper> findByIdIn(List<String> paperIds);

    List<Paper> findBySpecialtyCodeAndOrgId(String specialtyCode, String orgId);

    Paper findByNameAndOrgIdAndPaperType(String name, String orgId, PaperType paperType);

    List<Paper> findByPaperType(PaperType paperType);

	void deleteByOrgId(String orgId);

}
