package com.cooleshow.student.contract;

import android.view.View;

import com.cooleshow.base.presenter.view.BaseView;
import com.cooleshow.student.bean.FriendInfoBean;
import com.cooleshow.student.bean.LiveRoomInfoBean;
import com.rong.io.live.message.RCChatJoinRoomMessage;
import com.rong.io.live.message.RCOnSnappingUpMessage;
import com.rong.io.live.message.RCUserKickOutMessage;
import com.rong.io.live.message.RCUserLogOutUnusualMessage;
import com.rong.io.live.message.RCUserSeatApplyMessage;
import com.rong.io.live.message.RCUserSeatResponseMessage;
import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;

import java.util.List;

import cn.rongcloud.rtc.api.RCRTCRemoteUser;
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
import cn.rongcloud.rtc.base.RCRTCLiveRole;
import io.rong.imlib.model.Message;
import io.rong.imlib.model.MessageContent;

/**
 * Author by pq, Date on 2022/3/29.
 */
public interface LiveRoomContract {
    interface view extends BaseView {
        void getRoomInfoSuccess(LiveRoomInfoBean roomInfoBean);

        void getRoomInfoError(Throwable t);

        void showFinishView();

        void syncAudioStatus(boolean isCloseAudioStream);

        //显示休息一下再回来状态图
        void showRestView();

        //显示主播关闭的视频状态图
        void showCloseVideoView();

        void showEmptyStatusView();

        View getContentView();

        /**
         * 添加多条公屏消息
         */
        void addMessageList(List<MessageContent> messageContents, boolean isReset);

        /**
         * 添加单条公屏消息
         */
        void addMessageContent(Message message, boolean isReset);


        /**
         * 聊天模式控制消息
         *
         * @param isEnableChat
         */
        void switchChatMode(boolean isEnableChat);

        /**
         * 关闭直播间
         */
        void liveRoomOffline();

        /**
         * 直播间商品
         *
         * @param goodsStr
         */
        void liveGoodsChange(String goodsStr);

        /**
         * 连麦回复
         *
         * @param rcUserSeatResponseMessage
         */
        void seatResponse(RCUserSeatResponseMessage rcUserSeatResponseMessage);


        void onSwitchRole(String id, RCRTCLiveRole role);

        void onUserJoinRoom(RCRTCRemoteUser rcrtcRemoteUser);

        /**
         * 观众下麦(身份从主播切换到观众)
         */
        void onUserLeftRoomMic(RCRTCRemoteUser rcrtcRemoteUser);

        /**
         * 观众下麦(身份从主播切换到观众)
         */
        void onUserOfflineRoomMic(RCRTCRemoteUser rcrtcRemoteUser);

        /**
         * 同步成员数量
         *
         * @param count
         */
        void syncMemberCount(String count);

        /**
         * 用户被踢出房间消息
         *
         * @param userKickOutMessage
         */
        void onUserKickOutMsg(RCUserKickOutMessage userKickOutMessage);

        //连麦模式控制消息
        void changeMicControlMode(boolean isEnableMic);

        /**
         * 拿到RCRTCRoom用于显示直播view
         */
        void subscribeAVStreamSuccess(List<RCRTCInputStream> inputStreams);

        void onSubscribeFailed();

        /**
         * 设置房间数据
         */
        void setRoomData(LiveRoomInfoBean roomInfoBean);

        //连麦成功(身份切换成功)
        void onSeatMicSuccess();

        //连麦失败
        void onSeatMicFail();

        //取消连麦成功(身份切换观众成功)
        void onExitSeatMicSuccess();

        //邀请上麦
        void onInviteSeatMic(RCUserSeatApplyMessage seatApplyMessage);

        //用户异常退出消息
        void onUserUnusualLogout(RCUserLogOutUnusualMessage loginOutUnusualMessage);

        /**
         * 暂停直播
         */
        void onLivePause();

        void onAddLikeMessage(Message message, RCUserSyncAddLikeCountMessage addLikeMessage);

        void getFriendInfoSuccess(FriendInfoBean friendInfoBean);

        void onPublishSuccess();

        /**
         * 黑名单用户状态切换
         * @param userId
         * @param isAddBlack
         */
        void changeBlackUserStatus(String userId,boolean isAddBlack);
        /**
         * 加入房间消息
         *
         * @param joinRoomMessage
         */
        void receiveJoinMessage(RCChatJoinRoomMessage joinRoomMessage);

        /**
         * 抢购消息
         *
         * @param
         */
        void receiveSnapUpMessage(RCOnSnappingUpMessage snappingUpMessage);

        /**
         * 远端有用户推流
         * @param remoteUserId
         */
        void onRemoteUserPublishResource(String remoteUserId);
    }

    interface Presenter {
        void getRoomInfo(String roomId);

        void notifyJoinRoomAction(String roomId, String userId);

        void notifyLeaveRoomAction();

        void handleAction(int action);

        void getUserInfoByUserId(String friendUserId);
    }
}
