package com.keao.edu.user.service;

import com.keao.edu.common.page.PageInfo;
import com.keao.edu.common.service.BaseService;
import com.keao.edu.im.api.entity.PublishMessageDto;
import com.keao.edu.user.dto.ExamRoomStudentRelationDto;
import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
import com.keao.edu.user.dto.NeedCheckingDetailDto;
import com.keao.edu.user.dto.RoomStudentListDto;
import com.keao.edu.user.dto.StuRecordDetailDto;
import com.keao.edu.user.page.ExamRoomStudentRelationQueryInfo;

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

public interface ExamRoomStudentRelationService extends BaseService<Long, ExamRoomStudentRelation> {

    /**
     * 开启/关闭教室
     * @param openFlag
     * @param examinationBasicId
     * @param studentId
     */
    void switchClassRoom(Integer openFlag, Integer examinationBasicId, Integer studentId);

    /**
     * @describe 给教室分配学员
     * @author Joburgess
     * @date 2020.06.24
     * @param examRoomId:
     * @param registIds:
     * @return void
     */
    void addStudentForRoom(Long examRoomId, String registIds, Integer organId);

    /**
     * @describe 更换学员考场
     * @author Joburgess
     * @date 2020.07.08
     * @param registId:
     * @param examRoomId:
     * @return void
     */
    void changeStudentExamRoom(Long registId, Long examRoomId, Integer organId);

    /**
     * @describe 获取教室学员
     * @author Joburgess
     * @date 2020.06.24
     * @param queryInfo:
     * @return com.keao.edu.common.page.PageInfo<com.keao.edu.user.dto.ExamRoomStudentRelationDto>
     */
    PageInfo<ExamRoomStudentRelationDto> findExamRoomStudents(ExamRoomStudentRelationQueryInfo queryInfo);

    /**
     * @describe 删除指定教室学员
     * @author Joburgess
     * @date 2020.06.24
     * @param examRoomId:
     * @param registIds:
     * @return void
     */
    void deleteStudentFromRoom(Long examRoomId, String registIds, Integer organId);

    /**
     * 获取教室学员关联
     * @param registrationId
     * @return
     */
    ExamRoomStudentRelation getExamRoomStudentRelation(Long registrationId);

    /**
     * 下一位
     * @param examStatus 是否完成考试1是0否
     */
    void nextBit(Integer examStatus,Long roomId);

    public void publishMessage(ExamRoomStudentRelation examRoomStudentRelation,Integer action,Boolean isPush,Integer operator);

    public PublishMessageDto getPublishMessage(Long examRegistrationId);

    /**
     * 队列
     * @param roomId
     * @return
     */
    Map<String,Object> queryNeedCheckingList(Long roomId);

    /**
     * 签到
     * @param examRegistrationId
     */
    void signIn(Long examRegistrationId);

    /**
     * 监考端去录播
     * @param roomId 房间编号
     */
    void recorded(Long roomId);

    /**
     * 学生端去录播
     * @param examRegistrationId
     */
    NeedCheckingDetailDto stuRecorded(Long examRegistrationId);

    /**
     * 重新排队
     * @param examRegistrationId
     */
    NeedCheckingDetailDto againQueue(Long examRegistrationId);

    List<ExamRoomStudentRelation> findStudentsWithExamRooms(List<Long> examRoomIds);

    void deleteWithExamRooms(List<Long> examRoomIds);

    String getStudentIds(Long examRoomId);

    /**
     * 获取学员编号注册编号map
     * @param examRoomId
     * @return
     */
    List<Map<Integer, String>> getStuRegistrationMap(Long examRoomId);

    /**
     * 学生端录播详情页面
     * @param examRegistrationId
     * @return
     */
    StuRecordDetailDto stuRecordDetail(Long examRegistrationId);

    /**
     * 学生端完成录播
     * @param examRegistrationId
     * @param videoUrl
     */
    void stuEndRecord(Long examRegistrationId, String videoUrl);

    /**
     * 开始考试
     * @param roomId
     */
    void actionExam(Long roomId);

    /**
     * 获取已签到的学员
     * @param examRoomId
     * @return
     */
    Integer countSignInNum(Long examRoomId);

    /**
     * 获取报名学员所在教室
     * @param examRegistrationId
     * @return
     */
    ExamRoomStudentRelation getStudentExamRoom(Long examRegistrationId);
}
