import 'package:fis_jsonrpc/rpc.dart';

class LiveCourse {
  String? initiatorCode;
  int roomNo;
  TransactionStatusEnum? liveProtocol;
  int appId;
  String? userSign;
  LiveDataDTO? courseChannel;
  LiveDataDTO? othersScreenSharingChannel;
  List<LiveCourseMember>? deviceLiveDatas;
  List<LiveCourseMember>? memberLiveDatas;
  ScreenSharingChannelDTO? rtcScreenSharingChannel;
  LiveCourse({
    this.initiatorCode,
    this.roomNo = 0,
    this.liveProtocol,
    this.appId = 0,
    this.userSign,
    this.memberLiveDatas,
    this.courseChannel,
    this.deviceLiveDatas,
    this.othersScreenSharingChannel,
    this.rtcScreenSharingChannel,
    String? courseCode,
  });

  factory LiveCourse.fromInitDto(InitiateLiveCourseResult result) {
    return LiveCourse(
      initiatorCode: result.initiatorCode,
      roomNo: result.roomNo,
      liveProtocol: result.liveProtocol,
      appId: result.appId,
      userSign: result.userSign,
      memberLiveDatas: result.memberLiveDatas,
      courseCode: result.courseCode,
      othersScreenSharingChannel: result.othersScreenSharingChannel,
      courseChannel: result.courseChannel,
      rtcScreenSharingChannel: result.rtcScreenSharingChannel,
    );
  }

  factory LiveCourse.fromJoinDto(JoinLiveCourseResult result) {
    return LiveCourse(
      initiatorCode: result.userCode,
      roomNo: result.roomNo,
      liveProtocol: result.liveProtocol,
      appId: result.appId,
      userSign: result.userSign,
      memberLiveDatas: result.memberLiveDatas,
      courseCode: result.courseCode,
      othersScreenSharingChannel: result.othersScreenSharingChannel,
      courseChannel: result.courseChannel,
      deviceLiveDatas: result.deviceLiveDatas,
      rtcScreenSharingChannel: result.rtcScreenSharingChannel,
    );
  }
}
