package com.rf.psychological.scale.service;


import com.rf.psychological.dao.model.CognitiveTaskEntity;
import org.springframework.data.domain.Page;

import java.util.List;
import java.util.Optional;

/**
 * @author zsy
 * @description:认知任务信息管理
 * @date 2021/6/17 15:55
 */
public interface CognitiveTaskService {

    /**
     * 保存
     *
     * @param cognitiveTaskEntity
     */
    void save(CognitiveTaskEntity cognitiveTaskEntity);

    /**
     * 获取认知任务列表
     *
     * @return
     */
    List<CognitiveTaskEntity> findAll(int pageNum, int pageSize);

    /**
     * 总条数
     *
     * @return
     */
    int allNum();

    /**
     * 根据名称模糊查询列表
     *
     * @return
     */
    List<CognitiveTaskEntity> getCognizeListByName(int pageNum, int pageSize, String searchStr);

    /**
     * 根据名称模糊查询总条数
     *
     * @return
     */
    int allNumByName(String searchStr);

    /**
     * 某类别下所有信息列表
     *
     * @return
     */
    List<CognitiveTaskEntity> findAllCategory(int pageNum, int pageSize, String categoryEname);

    /**
     * 某类别下总条数
     *
     * @return
     */
    int allNumCategory(String categoryEname);

    /**
     * 某类别下根据名称模糊查询列表
     *
     * @return
     */
    List<CognitiveTaskEntity> getCognizeListByNameCategory(int pageNum, int pageSize, String scaleName, String categoryEname);

    /**
     * 根据id查找认知任务
     *
     * @param id
     * @return
     */
    Optional<CognitiveTaskEntity> getAllById(String id);

    /**
     * 某类别下模糊查询总条数
     *
     * @return
     */
    int allNumByNameCategory(String scaleName, String categoryEname);

    /**
     * 根据taskCode记录测试数
     *
     * @return
     */
    void addTestNum(String taskCode);

    /**
     * 查询用户认知任务权限
     *
     * @param uId
     * @param scaleName
     * @return
     */
    Page<CognitiveTaskEntity> findUserTaskAuth(String uId, String scaleName, int beginNum, int pageSize, Boolean mobile);

    /**
     * 查询用户认知任务权限，通过类别
     *
     * @param uId
     * @param scaleName
     * @param cateEName
     * @param beginNum
     * @param pageSize
     * @return
     */
    Page<CognitiveTaskEntity> findUserTaskAuthAndCateEName(String uId, String scaleName, String cateEName, int beginNum, int pageSize, Boolean mobile);

    /**
     * 查询机构认知任务权限，包含类别
     *
     * @param institutionNo
     * @param scaleName
     * @param cateEName
     * @param beginNum
     * @param pageSize
     * @return
     */
    Page<CognitiveTaskEntity> findInstitutionTaskAuthAndCateEName(String institutionNo, String scaleName, String cateEName, int beginNum, int pageSize, Boolean mobile);

    Page<CognitiveTaskEntity> findInstitutionNoCTAuthList(String institutionNo, String searchKey, int beginNum, int pageSize);

    CognitiveTaskEntity getCognizeListByTaskCode(String taskCode);

    List<CognitiveTaskEntity> getTrendingSearches(int numberFive);

    List<CognitiveTaskEntity> getRelevantEvaluation(String taskCode);
}
