import 'package:fis_i18n/i18n.dart';
import 'package:fis_jsonrpc/rpc.dart';
import 'package:fis_ui/index.dart';
import 'package:flyinsono/architecture/states/states.dart';
import 'package:flyinsono/architecture/values/features.dart';
import 'package:flyinsono/views/common/device_live/device_live_list/index.dart';
import 'package:get/get.dart';

class DeviceLiveListDesktopState extends DeviceLiveListState {
  final Rx<List<FSelectOptionModel>> _applyDeviceList =
      Rx(<FSelectOptionModel>[]);
  final Rx<String> _packageName = Rx('');
  final Rx<String> _description = Rx('');
  final Rx<String?> _applyDeviceCode = Rx(null);
  final Rx<String?> _adaptSystemVersion = Rx(null);
  final Rx<String> _applySoftwareVersion = Rx('');
  final Rx<String> _updateFileName = Rx('');
  final Rx<List<FSelectOptionModel>> _printerSystemList =
      Rx(<FSelectOptionModel>[
    FSelectOptionModel(title: 'Win7', value: 'Win7'),
    FSelectOptionModel(title: 'Win10', value: 'Win10'),
    FSelectOptionModel(
        title: i18nBook.setting.currency.t, value: i18nBook.setting.currency.t),
  ]);

  final Rx<double> _uploadProgress = Rx(0);
  final Rx<bool> _tableLoading = Rx(false);
  final Rx<bool> _isCanSubmitPackage = Rx(false);
  final Rx<String> _applySystemVersion = Rx('');
  final Rx<List<DevicePatchDTO>> _updatePackageTableContent =
      Rx(<DevicePatchDTO>[]);
  final RxList<DevicePrinterDTO> _printDriverTableDatas =
      RxList(<DevicePrinterDTO>[]);
  final Rx<bool> _uploadingUpdatePackage = Rx(false);

  List<DevicePrinterDTO> get printDriverTableDatas => _printDriverTableDatas;
  set printDriverTableDatas(List<DevicePrinterDTO> v) =>
      _printDriverTableDatas.value = v;

  /// 更新包管理的表格内容
  set updatePackageTableContent(List<DevicePatchDTO> value) =>
      _updatePackageTableContent.value = value;
  List<DevicePatchDTO> get updatePackageTableContent =>
      _updatePackageTableContent.value;

  List<FTableColumn<DevicePrinterDTO>> printDriverTable = [];

  /// 适用设备列表
  set applyDeviceList(List<FSelectOptionModel> value) =>
      _applyDeviceList.value = value;
  List<FSelectOptionModel> get applyDeviceList => _applyDeviceList.value;

  /// 打印机设置系统列表
  set printerSystemList(List<FSelectOptionModel> value) =>
      _printerSystemList.value = value;
  List<FSelectOptionModel> get printerSystemList => _printerSystemList.value;

  /// 更新包 名称
  set packageName(String value) => _packageName.value = value;
  String get packageName => _packageName.value;

  /// 更新包 描述
  set description(String value) => _description.value = value;
  String get description => _description.value;

  /// 更新包 适配设备
  set applyDeviceCode(String? value) => _applyDeviceCode.value = value;
  String? get applyDeviceCode => _applyDeviceCode.value;

  /// 打印机驱动管理 适配系统
  set adaptSystemVersion(String? value) => _adaptSystemVersion.value = value;
  String? get adaptSystemVersion => _adaptSystemVersion.value;

  /// 更新包 适配软件版本
  set applySoftwareVersion(String value) => _applySoftwareVersion.value = value;
  String get applySoftwareVersion => _applySoftwareVersion.value;

  /// 更新包 本地更新包文件
  set updateFileName(String value) => _updateFileName.value = value;
  String get updateFileName => _updateFileName.value;

  /// 更新包 适配系统版本
  set applySystemVersion(String value) => _applySystemVersion.value = value;
  String get applySystemVersion => _applySystemVersion.value;

  /// 进度条
  set uploadProgress(double value) => _uploadProgress.value = value;
  double get uploadProgress => _uploadProgress.value;

  /// 表格loadding
  set tableLoading(bool value) => _tableLoading.value = value;
  bool get tableLoading => _tableLoading.value;

  set isCanSubmitPackage(bool value) => _isCanSubmitPackage.value = value;
  bool get isCanSubmitPackage => _isCanSubmitPackage.value;

  /// 正在上传更新包中
  set uploadingUpdatePackage(bool value) =>
      _uploadingUpdatePackage.value = value;
  bool get uploadingUpdatePackage => _uploadingUpdatePackage.value;
}
