package com.keao.edu.im.service;

import com.keao.edu.im.api.entity.PublishMessageDto;
import com.keao.edu.im.api.entity.ReqUserData;
import com.keao.edu.im.common.ApiException;
import com.keao.edu.im.common.BaseResponse;
import com.keao.edu.im.pojo.*;
import org.springframework.scheduling.annotation.Async;

import java.io.IOException;
import java.util.List;

/**
 * Created by super_zou on 2019/11/28.
 */
public interface RoomService {
    //everyone
    public BaseResponse joinRoom(Long registrationId, boolean isAudience, boolean isDisableCamera, boolean isMusicMode, String roomId) throws ApiException, Exception;

    void roomQuery(String roomId) throws Exception;

    void configRecord(String roomId,String userId) throws Exception;

    void startRecord(String roomId,String userId) throws Exception;

    void stopRecord(String userId,String roomId) throws Exception;

    public Boolean leaveRoom(Long registrationId,String roomId,String userId) throws ApiException, Exception;

    //only host
    public Boolean downgrade(String roomId, List<ReqChangeUserRoleData.ChangedUser> users) throws ApiException, Exception;

    /**
     * 销毁房间
     * @param roomId
     */
    public void destroyRoom(Long roomId,String userId) throws Exception;

    public Boolean kickMember(ReqUserData data) throws ApiException, Exception;


    //only teacher
//    public Boolean display(String roomId, int type, String uri) throws ApiException, Exception;

    public String createWhiteBoard(String roomId) throws ApiException, Exception;

    public Boolean deleteWhiteboard(String roomId, String whiteBoardId) throws ApiException, Exception;

    public List<RoomResult.WhiteboardResult> getWhiteboard(String roomId) throws ApiException, Exception;

    public Boolean turnWhiteBoardPage(String roomId, String whiteBoardId, int page) throws ApiException, Exception;

    public Boolean controlDevice(String roomId, String userId, DeviceTypeEnum type, boolean enable) throws ApiException, Exception;

    Boolean batchControlDevice(ReqDeviceControlData data) throws Exception;

    public Boolean approveControlDevice(String roomId, String ticket) throws ApiException, Exception;

    public Boolean rejectControlDevice(String roomId, String ticket) throws ApiException, Exception;


    public List<RoomResult.MemberResult> getMembers(String roomId) throws  ApiException, Exception;

//    public Boolean applySpeech(String roomId) throws  ApiException, Exception;

    public Boolean approveSpeech(String roomId, String requestId) throws  ApiException, Exception;

    public Boolean rejectSpeech(String roomId, String requestId) throws  ApiException, Exception;


    public Boolean transfer(String roomId, String userId) throws ApiException, Exception;

    public Boolean inviteUpgradeRole(String roomId, String userId, int role) throws  ApiException, Exception;
    public Boolean approveUpgradeRole(String roomId, String ticket) throws ApiException, Exception;
    public Boolean rejectUpgradeRole(String roomId, String ticket) throws ApiException, Exception;

    public Boolean syncDeviceState(String roomId, DeviceTypeEnum type, boolean enable) throws ApiException, Exception;

    public Boolean changeRole(String roomId, String userId, int role) throws ApiException, Exception;

    public void destroyRoom(String roomId);
    public Boolean memberOnlineStatus(List<ReqMemberOnlineStatus> statusList, String nonce, String timestamp, String signature) throws ApiException, Exception;
    public void userIMOfflineKick(String userId);

    boolean statusSync(String roomId,String userId) throws Exception;

    /**
     * 发送消息
     * @param publishMessageDto
     */
    void publishMessage(PublishMessageDto publishMessageDto) throws Exception;

    /**
     * 开始录播
     * @param examRegistrationId
     */
    RoomResult joinRecorded(Long examRegistrationId) throws Exception;

    /**
     * 结束录播
     * @param examRegistrationId
     */
    Boolean levelRecorded(Long examRegistrationId) throws Exception;

    /**
     * 加入群组
     * @param userIds
     * @param groupId
     * @param groupName
     */
    void joinGroup(String userIds, String groupId, String groupName) throws Exception;

    /**
     * 退群
     * @param userIds
     * @param groupId
     */
    void quitGroup(String userIds, String groupId) throws Exception;

    /**
     * 解散
     * @param userId
     * @param groupId
     */
    void dismissGroup(String userId, String groupId) throws Exception;
}
