import 'package:flyinsono/architecture/define.dart';
import 'package:flyinsono/managers/interfaces/entities/device_entities.dart';
import 'package:get/get.dart';

class DeviceLiveDetailMobileState {
  final _liveInfo = FRx<DeviceLiveDisplayInfoModel?>(null);

  /// 设备编码
  String deviceCode = '';

  /// 是否单路
  bool get isSingleChannel => liveInfo!.sources.length == 1;

  /// 直播信息
  DeviceLiveDisplayInfoModel? get liveInfo => _liveInfo.value;

  set liveInfo(DeviceLiveDisplayInfoModel? val) => _liveInfo.updateValue(val);

  /// 是否支持 nodeplayer 拉流
  Rx<bool> _isSupportNodePlayer = true.obs;

  bool get isSupportNodePlayer => _isSupportNodePlayer.value;
  set isSupportNodePlayer(bool val) => _isSupportNodePlayer.value = val;

  /// 直播信息是否初始化完成
  Rx<bool> _isLiveInfoInited = false.obs;
  bool get isLiveInfoInited => _isLiveInfoInited.value;
  set isLiveInfoInited(bool val) => _isLiveInfoInited.value = val;

  /// 大牛直播是否拉取到首帧
  Rx<bool> _isDaniuLiveFirstFrameRendered = true.obs;
  bool get isDaniuLiveFirstFrameRendered =>
      _isDaniuLiveFirstFrameRendered.value;
  set isDaniuLiveFirstFrameRendered(bool val) =>
      _isDaniuLiveFirstFrameRendered.value = val;

  /// RTMP 模式下的主画面宽高
  Rx<int> _rtmpMainViewWidth = 0.obs;
  Rx<int> _rtmpMainViewHeight = 0.obs;
  int get rtmpMainViewWidth => _rtmpMainViewWidth.value;
  int get rtmpMainViewHeight => _rtmpMainViewHeight.value;
  set rtmpMainViewWidth(int val) => _rtmpMainViewWidth.value = val;
  set rtmpMainViewHeight(int val) => _rtmpMainViewHeight.value = val;

  /// RTMP 模式下的子画面宽高
  Rx<int> _rtmpSubViewWidth = 0.obs;
  Rx<int> _rtmpSubViewHeight = 0.obs;
  int get rtmpSubViewWidth => _rtmpSubViewWidth.value;
  int get rtmpSubViewHeight => _rtmpSubViewHeight.value;
  set rtmpSubViewWidth(int val) => _rtmpSubViewWidth.value = val;
  set rtmpSubViewHeight(int val) => _rtmpSubViewHeight.value = val;

  /// RTMP 模式下是否为合图模式
  Rx<bool> _isRtmpUseMerge = false.obs;
  bool get isRtmpUseMerge => _isRtmpUseMerge.value;
  set isRtmpUseMerge(bool val) => _isRtmpUseMerge.value = val;

  /// 是否存在子窗口
  Rx<bool> _isSubViewExist = false.obs;
  bool get isRtmpSubViewExist => _isSubViewExist.value;
  set isRtmpSubViewExist(bool val) => _isSubViewExist.value = val;

  /// 大牛子窗口是否展开
  Rx<bool> _isDaniuSubViewExpanded = true.obs;
  bool get isDaniuSubViewExpanded => _isDaniuSubViewExpanded.value;
  set isDaniuSubViewExpanded(bool val) => _isDaniuSubViewExpanded.value = val;

  /// 大牛子窗口是否靠右
  Rx<bool> _isDaniuSubViewAlignRight = true.obs;
  bool get isDaniuSubViewAlignRight => _isDaniuSubViewAlignRight.value;
  set isDaniuSubViewAlignRight(bool val) =>
      _isDaniuSubViewAlignRight.value = val;

  /// 是否是老设备
  Rx<bool> _isOldPlatform = false.obs;
  bool get isOldPlatform => _isOldPlatform.value;
  set isOldPlatform(bool val) => _isOldPlatform.value = val;
}
