import 'package:fis_common/event/event_type.dart';
import 'package:fis_jsonrpc/rpc.dart';
import 'package:flyinsono/managers/live_course_listening_manager.dart';

import 'entities/live_course.dart';

abstract class ILiveCourseManager {
  final onJoinLiveCourse = FEventHandler<JoinLiveCourseNotification>();
  final onMute = FEventHandler<MuteLiveCourseNotification>();
  final onNetworkErr = FEventHandler<NetworkErrCourseNotification>();
  final onHeartRateLeave = FEventHandler<HeartRateLeaveCourseNotification>();
  final onHeartRateJoin = FEventHandler<HeartRateJoinCourseNotification>();
  final onCloseLiveCourse = FEventHandler<CloseLiveCourseNotification>();
  final onSwitchVideoOpend = FEventHandler<SwitchLiveCourseVideoNotification>();
  final onLeave = FEventHandler<LeaveLiveCourseNotification>();
  final onCourseStatusChange = FEventHandler<CourseStatusNotification>();
  final onBoardDataReceive =
      FEventHandler<SendLiveInteractiveBoardDataNotification>();
  final onChangeShareInLiveCourse =
      FEventHandler<ChangeShareInLiveCourseNotification>();
  final onProcessChange = FEventHandler<double>();
  final exitDesktopSharing = FEventHandler<bool>();
  late final LiveCourseListeningManager listeningManager;

  ///离开课程
  Future<LiveCourseBaseResult> leaveLiveCourse(String code);

  ///获取课程详情
  Future<CourseInfoDetailDTO> getCourseInfo(String code);

  ///开始直播
  Future<LiveCourse> initiateLiveCourse(String code);

  ///加入课程
  Future<LiveCourse> joinLiveCourse(String courseCode);

  ///获取课程拉流地址
  Future<StudentLivePullUrlResult> getCoursePullUrl(String code);

  ///设备接入房间(废弃)
  Future<LiveCourseMember> deviceJoinInLiveCourse(
      String deviceCode, String courseCode);

  ///打开直播页
  Future<void> openLiveCoursePage(String courseId);

  ///设置开启或关闭静音状态
  Future<LiveCourseBaseResult> setMemberMute(String courseCode, bool isMute);

  ///开启或关闭视频
  Future<LiveCourseBaseResult> setVideoLiveCourse(
      String courseCode, bool isOpenVideo);

  ///设置分享屏幕或超声机
  Future<void> setShareInLiveCourse(
    String courseCode,
    String currentShareMemberCode, {
    CourseShareType currentShareType = CourseShareType.Window,
    CourseShareStates currentShareState = CourseShareStates.Opened,
  });

  ///开始录制
  Future<void> startRecording(String courseCode);

  ///结束录制
  void stopRecording();
}
