package com.ez.ertc.meeting.contract;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.widget.ImageView;

import com.ez.basertc.RTCConstant;
import com.ez.ertc.meeting.base.YsBasePresenter;
import com.ez.ertc.meeting.base.YsBaseView;
import com.ez.ertc.meeting.event.MtAudioModeEvent;
import com.ez.ertc.meeting.event.MtCallStateEvent;
import com.ez.ertc.meeting.event.MtExitRoomEvent;
import com.ez.ertc.meeting.event.MtLanActionEvent;
import com.ez.ertc.meeting.event.MtMemberEnterEvent;
import com.ez.ertc.meeting.event.MtMemberExitEvent;
import com.ez.ertc.meeting.event.MtSwitchMemberToastEvent;
import com.ez.ertc.meeting.event.MtSwitchStimulationEvent;
import com.ez.ertc.meeting.event.MtSwitchWaterMarkEvent;
import com.ez.ertc.meeting.event.MtToTestEvent;
import com.ez.ertc.meeting.event.MtToggleSelfAudioEvent;
import com.ez.ertc.meeting.widget.ErtcTextureView;
import com.ez.ertcmeeting.bean.UserAccount;

import java.util.List;
import java.util.Set;


/**
 * @author xiezuoyuan
 * @time 2019/9/18 14:17
 */
public interface ErtcRoomContract {
    interface View extends YsBaseView<Presenter> {
        Activity getActivity();
        void setLeaveTxt(int resId);
        void toggleCoverShow();
        void animCoverShow();
        void animCoverHide();
        void onFlow(String txt);
        void setRoomId(String id);
        void setScreenAccountStreamId(String userId, boolean visibility);
        void setMicroState(boolean on);
        void setCameraState(boolean on);
        void setSoundState(boolean on);
        void setShareState(boolean on, boolean disable);
        void setSelfAudioLevel(int level);
        void setScreenAudioLevel(int level);
        void showHostLeaveDialog();
        void showMemberLeaveDialog();
        void setCallingNumber(int number);
        void disableManageButton();
        ErtcTextureView getScreenTextureView();
        void showShareDesktopCover(boolean show);
        ImageView getShareDesktopCover();
        void showFlowView(boolean show);
        void updateFlowViewName(String name);
        void updateFlowViewAudio(boolean on);
        void updateFlowViewLevel(int level);
        void updateMemberCount(int count);
        void updateScreenAccountView(String avatar, String userId, boolean isAudioOn);
        void updateScreenKpsLevel(int level);
        void hideScreenAccountVideo();
        void showScreenAccountVideo();
        void showMsgBubble();
        void hideMsgBubble();
        void startSharePhoto(String address, int port, String roomId, String userId, boolean canWrite, String photo);
        void startShareBoard(String address, int port, String roomId, String userId, boolean canWrite);
        void showDesktopPInPButton(boolean show);
        void requestToggleCameraPermission();
        void requestToggleMicrophonePermission();
    }

    interface GroupView {
        void init(Configuration newConfig, int screenWidth, int screenHeight);
        void onConfigurationChanged(int orientation);
        void notifyDataChanged(List<UserAccount> mAccountList);
        void notifyItemChanged(UserAccount account);
        void notifyExit(UserAccount account);
        void notifySwitchToScreen(UserAccount account);
        void updateBtnVisibility();
        ErtcTextureView findTextureView(String userId);
        void setPresenter(Presenter presenter);
        void updateSelfDelayLevel(String userId, int level);
        void setSelfAudioLevel(int level);
        void setMemberAudioLevel(String userId, int level);
        void showGroupView();
        void hideGroupView();
        Set<String> getCurrentPageAccounts();
        boolean hasMember(String userId);
        void showWaterMark(boolean show);
        void updateWaterMark();
    }

    interface ItemViewHolder {
        void bindView(UserAccount account);
        void unbind();
        void clearPixels();
        ErtcTextureView getTextureView();
        UserAccount getAccount();
        void updateSelfDelayLevel(int level);
        void setAudioLevel(int level);
        void updateView(int orientation, int landscapeTopMargin);
        void showWaterMark(boolean show);
        void updateWaterMark();
    }

    interface InputView {
        void showInputView();
        boolean hideInputView();
        void setPresenter(Presenter presenter);
        void onMessageEvent(MtMemberExitEvent event);
        void onMessageEvent(MtMemberEnterEvent event);
    }
    interface TalkingView {
        void showTalkingView();
        void hideTalkingView();
        boolean isShowing();
        void updateTalkingView(List<String> names);
        void onConfigurationChanged(int orientation);
    }

    interface Presenter extends YsBasePresenter {
        void initApi(RTCConstant.EnterParam enterParam, boolean isAudioOn,
                     boolean isVideoOn, boolean isSoundOn);
        void switchCamera();
        void toggleMicro();
        void toggleCamera();
        void toggleSound();
        void toMemberManage();
        void toMemberManageCalling();
        void toMeetingSets();
        void toAlbumProxy();
        void toBeautyConfig();
        void onNewIntent();
        void showMonitor();
        void onMessageEvent(MtExitRoomEvent event);
        void onMessageEvent(MtSwitchStimulationEvent event);
        void onMessageEvent(MtSwitchMemberToastEvent event);
        void onMessageEvent(MtSwitchWaterMarkEvent event);
        void onMessageEvent(MtToggleSelfAudioEvent event);
        void onMessageEvent(MtAudioModeEvent event);
        void onMessageEvent(MtToTestEvent event);
        void onMessageEvent(MtCallStateEvent event);
        void onMessageEvent(MtLanActionEvent event);
        void onConfigurationChanged(int orientation);
        void startRecord();
        void createScreenRecorder(int requestCode, int resultCode, Intent data);
        void onLeave();
        void endMeeting();
        void setErtcEngineIsNullLeaveState(boolean state);
        void release(String cause);
        void onPause();
        void onStop();
        void onRestart();
        void onResume();
        boolean isDestroy();
        void cancelCoverHandler();
        void setLowStream(UserAccount account);
        void setLowStreamForce(UserAccount account);
        void setHighStream(UserAccount account);
        void disableReceiveStreamAll();
        void disableReceiveStream(String userId);
        void enableReceiveStream(String userId);
        String getSharingDesktopUserId();
        void setScreenAccount(UserAccount account);
        UserAccount getScreenAccount();
        UserAccount getMyAccount();
        void openWhiteBoard();
        void shareWithPhoto(Uri data);
        boolean closeShare();
        void setPInP(boolean on);
        boolean isPInP();
        void startDesktopPInP();
        boolean isSharing();
        void onDestroy();
        void stopShareService();
        View getView();
    }
}
