import 'package:fis_jsonrpc/rpc.dart';

class DeviceLiveRoom extends JoinDeviceLiveRoomResult {
  bool enableCamera = true;
  bool muteMode = false;

  DeviceLiveRoom.fromJoinDeviceLiveRoomResult(
    JoinDeviceLiveRoomResult j, {
    bool enableCamera = true,
    bool muteMode = false,
  }) {
    super.deviceCode = j.deviceCode;
    super.isOldPlatform = j.isOldPlatform;
    super.supportRtc = j.supportRtc;
    super.liveProtocol = j.liveProtocol;
    super.mergedChannel = j.mergedChannel;
    super.mergedVideoOutputHeight = j.mergedVideoOutputHeight;
    super.mergedVideoOutputWidth = j.mergedVideoOutputWidth;
    super.reportStateIntervalSeconds = j.reportStateIntervalSeconds;
    super.roomNo = j.roomNo;
    super.supportRtc = j.supportRtc;
    super.videoDeviceInfos = j.videoDeviceInfos;
    super.token = j.token;
    this.enableCamera = enableCamera;
    this.muteMode = muteMode;
  }

  Map<String, dynamic> toJson() {
    final map = super.toJson();
    map['RoomNo'] = roomNo;
    map['LiveProtocol'] = liveProtocol.index;
    if (deviceCode != null) map['DeviceCode'] = deviceCode;
    map['MergedChannel'] = mergedChannel;
    map['MergedVideoOutputWidth'] = mergedVideoOutputWidth;
    map['MergedVideoOutputHeight'] = mergedVideoOutputHeight;
    if (videoDeviceInfos != null) map['VideoDeviceInfos'] = videoDeviceInfos;
    map['ReportStateIntervalSeconds'] = reportStateIntervalSeconds;
    map['IsOldPlatform'] = isOldPlatform;
    map['SupportRtc'] = supportRtc;
    map['SupportRtc'] = supportRtc;
    map['EnableCamera'] = enableCamera;
    map['MuteMode'] = muteMode;
    return map;
  }
}
