package com.fs.course.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.fs.course.domain.FsCourseWatchLog;
import com.fs.course.param.*;
import com.fs.course.vo.*;
import com.fs.qw.param.QwSidebarStatsParam;
import com.fs.qw.vo.QwWatchLogStatisticsListVO;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 短链课程看课记录Service接口
 *
 * @author fs
 * @date 2024-09-18
 */
public interface IFsCourseWatchLogService extends IService<FsCourseWatchLog> {
    /**
     * 查询短链课程看课记录
     *
     * @param logId 短链课程看课记录主键
     * @return 短链课程看课记录
     */
    public FsCourseWatchLog selectFsCourseWatchLogByLogId(Long logId);

    /**
     * 查询短链课程看课记录列表
     *
     * @param fsCourseWatchLog 短链课程看课记录
     * @return 短链课程看课记录集合
     */
    public List<FsCourseWatchLog> selectFsCourseWatchLogList(FsCourseWatchLog fsCourseWatchLog);


    /**
     * 查询短链课程看课记录
     *
     * @param param 短链课程看课记录
     * @return 短链课程看课记录
     */
    public FsCourseWatchLog selectFsCourseWatchLog(FsCourseWatchLogParam param);


    /**
     * 新增短链课程看课记录
     *
     * @param fsCourseWatchLog 短链课程看课记录
     * @return 结果
     */
    public int insertFsCourseWatchLog(FsCourseWatchLog fsCourseWatchLog);

    /**
     * 修改短链课程看课记录
     *
     * @param fsCourseWatchLog 短链课程看课记录
     * @return 结果
     */
    public int updateFsCourseWatchLog(FsCourseWatchLog fsCourseWatchLog);

    /**
     * 批量删除短链课程看课记录
     *
     * @param logIds 需要删除的短链课程看课记录主键集合
     * @return 结果
     */
    public int deleteFsCourseWatchLogByLogIds(Long[] logIds);

    /**
     * 删除短链课程看课记录信息
     *
     * @param logId 短链课程看课记录主键
     * @return 结果
     */
    public int deleteFsCourseWatchLogByLogId(Long logId);

    FsCourseWatchLog getWatchCourseVideo(Long userId,Long videoId,String qwUserId,Long externalId);

    FsCourseWatchLog getWatchCourseLogVideoBySop(Long videoId,String qwUserId,Long externalId);


    List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVO(FsCourseWatchLogListParam param);

    List<FsCourseWatchLogListVO> selectFsCourseWatchLogListByParam(FsCourseWatchLogListParam param);

    void testFinishMsg();

    List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVO(FsCourseWatchLogStatisticsListParam param);

    /**
     * 新增企微看课统计汇总行查询
     * @param param
     * @return
     */
    FsCourseWatchLogStatisticsListVO getTotalDataAddItem(FsCourseWatchLogStatisticsListParam param);

    List<FsCourseWatchLogStatisticsListByCompanyVO> selectFsCourseWatchLogStatisticsListByCompanyVO(FsCourseWatchLogStatisticsListParam param);

    void scheduleBatchUpdateToDatabase();

    void checkWatchStatus();

    List<FsCourseUserStatisticsListVO> selectFsCourseUserStatisticsListVO(FsCourseUserStatisticsListParam param);

    List<FsCourseOverVO> selectFsCourseWatchLogOverStatisticsListVO(FsCourseOverParam param);

    void addCourseWatchLogDay();
    void addCourseWatchLogDayMinute(LocalDateTime start, LocalDateTime end);

    void addCourseWatchLogDay2();

    FsCourseWatchLog getWatchCourseVideoH5(Long videoId,String qwUserId,Long externalId);

    List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVONew(FsCourseWatchLogStatisticsListParam param);

    long selectFsCourseWatchLogStatisticsListVONewCount(FsCourseWatchLogStatisticsListParam param);

    void addCourseWatchLogDayNew();

    /**
     * 根据条件查询数量
     * @param params    参数
     * @return  count
     */
    int countByMap(Map<String, Object> params);

    void scheduleUpdateDurationToDatabase();

    void checkFsUserWatchStatus();

    /**
     * 查询看课记录数据信息
     * @param param
     * @return
     */
    List<FsCourseWatchLogListVO> selectListBytrainingCampId(PeriodStatisticCountParam param);

    FsCourseWatchLog getWatchCourseVideoIsOpen(Long userId, Long videoId);

    void scheduleBatchUpdateToDatabaseIsOpen();

    List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVOexport(FsCourseWatchLogListParam param);

    /**
     * 看课统计
     * */
    List<FsCourseWatchLogStatisticsListVO> selectQwFsCourseWatchLogStatisticsListVO(QwSidebarStatsParam param);

    /**
     * 根据看课记录id获取所有的外部联系人ids
     * @param watchLogIds
     * @return
     */
    List<Long> getExContactIdsIdsByWatchLogIds(List<Long> watchLogIds);
}
