import 'package:fis_jsonrpc/rpc.dart';
import 'package:fis_ui/widgets/tree/flutter_treeview/lib/flutter_treeview.dart';
import 'package:flyinsono/pages/organization/org_info/state.dart';
import 'package:get/get.dart' hide Node;

class VocabularyEntryState {
  final Rx<List<ThesaurusDTO>> _entryInfos = Rx(<ThesaurusDTO>[]);
  final Rx<List<ThesaurusDTO>> _keyWordsEntryInfos = Rx(<ThesaurusDTO>[]);
  final Rx<List<ThesaurusDTO>> _createEntryInfos = Rx(<ThesaurusDTO>[]);
  final Rx<List<ThesaurusDTO>> _systemEntryInfos = Rx(<ThesaurusDTO>[]);
  final Rx<List<Node>> _getTreeView = Rx(<Node>[]);
  final Rx<List<ThesaurusItemDTO>> _vocabularyCard = Rx(<ThesaurusItemDTO>[]);
  final Rx<List<OrgModel>> _classification = Rx(<OrgModel>[]);
  final Rx<List<OrgModel>> _editClassification = Rx(<OrgModel>[]);
  final Rx<List<ThesaurusItemDTO>> _allThesaurusItem = Rx(<ThesaurusItemDTO>[]);
  final Rx<List<ThesaurusItemDTO>> _selectedThesaurusItems =
      Rx(<ThesaurusItemDTO>[]);
  final Rx<List<ThesaurusItemDTO>> _thesaurusItem = Rx(<ThesaurusItemDTO>[]);
  final Rx<Map<String, dynamic>> _createThesaurus = Rx(<String, dynamic>{});
  final Rx<Map<String, dynamic>> _createClassification =
      Rx(<String, dynamic>{});
  final Rx<String> _thesaurusCode = Rx('');
  final Rx<String> _thesaurusName = Rx('');
  final Rx<String> _importThesaurusName = Rx('');
  final Rx<String> _editingThesaurusName = Rx('');
  final Rx<String> _selectedKey = Rx('');
  final Rx<String> _keyWords = Rx('');
  final Rx<String> _keyWord = Rx('');
  final Rx<String> _thesaurusKeyWords = Rx('');
  final Rx<ThesaurusItemDTO> _vocabularyCardItem = Rx(ThesaurusItemDTO());
  final Rx<bool> _isEnableEdit = Rx(false);
  final Rx<int> _activeEntryIndex = Rx(0);
  final Rx<ThesaurusUsageTypeEnum> _selectedVocType =
      Rx(ThesaurusUsageTypeEnum.People);
  ThesaurusTemplateInfoDTO? importThesaurusTemplateInfoDTO;
  get activeEntryIndex => _activeEntryIndex.value;

  /// 当前词条index
  set activeEntryIndex(value) => _activeEntryIndex.value = value;

  List<ThesaurusItemDTO> get allThesaurusItem => _allThesaurusItem.value;

  /// 词条卡片
  set allThesaurusItem(List<ThesaurusItemDTO> value) =>
      _allThesaurusItem(value);

  List<OrgModel> get classification => _classification.value;

  /// 上级词条分类
  set classification(List<OrgModel> value) => _classification(value);

  Map<String, dynamic> get createClassification => _createClassification.value;

  /// 创建词条分类的Map
  set createClassification(Map<String, dynamic> value) =>
      _createClassification(value);

  List<ThesaurusDTO> get createEntryInfos => _createEntryInfos.value;

  /// 创建词条库的数据
  set createEntryInfos(List<ThesaurusDTO> value) => _createEntryInfos(value);

  Map<String, dynamic> get createThesaurus => _createThesaurus.value;

  /// 创建词条库的Map
  set createThesaurus(Map<String, dynamic> value) => _createThesaurus(value);

  List<OrgModel> get editClassification => _editClassification.value;

  /// 上级编辑词条分类
  set editClassification(List<OrgModel> value) => _editClassification(value);

  /// 词条卡片集合
  List<ThesaurusDTO> get entryInfos => _entryInfos.value;
  set entryInfos(List<ThesaurusDTO> value) => _entryInfos(value);

  List<Node> get getTreeView => _getTreeView.value;

  /// 当前词条项
  set getTreeView(List<Node> value) => _getTreeView(value);

  bool get isEnableEdit => _isEnableEdit.value;

  /// 当前是否可以创建或编辑
  set isEnableEdit(bool value) => _isEnableEdit.value = value;

  ThesaurusUsageTypeEnum get selectedVocType => _selectedVocType.value;

  set selectedVocType(ThesaurusUsageTypeEnum value) =>
      _selectedVocType.value = value;

  String get keyWord => _keyWord.value;

  /// 手机端关键字搜索
  set keyWord(String value) => _keyWord.value = value;

  String get keyWords => _keyWords.value;

  /// 关键字搜索
  set keyWords(String value) => _keyWords.value = value;

  List<ThesaurusDTO> get keyWordsEntryInfos => _keyWordsEntryInfos.value;

  /// 根据关键字 词条卡片集合
  set keyWordsEntryInfos(List<ThesaurusDTO> value) =>
      _keyWordsEntryInfos(value);

  String get selectedKey => _selectedKey.value;

  /// 当前选中的词条分类的code
  set selectedKey(String value) => _selectedKey.value = value;

  List<ThesaurusItemDTO> get selectedThesaurusItems =>
      _selectedThesaurusItems.value;

  ///搜索后所有词条
  set selectedThesaurusItems(List<ThesaurusItemDTO> value) =>
      _selectedThesaurusItems(value);

  List<ThesaurusDTO> get systemEntryInfos => _systemEntryInfos.value;

  /// 词条系统默认卡片集合
  set systemEntryInfos(List<ThesaurusDTO> value) => _systemEntryInfos(value);

  String get thesaurusCode => _thesaurusCode.value;

  /// 当前词条Code
  set thesaurusCode(String value) => _thesaurusCode.value = value;

  String get thesaurusName => _thesaurusName.value;

  set thesaurusName(String value) => _thesaurusName.value = value;

  String get editingThesaurusName => _editingThesaurusName.value;

  set editingThesaurusName(String value) => _editingThesaurusName.value = value;

  String get importThesaurusName => _importThesaurusName.value;

  set importThesaurusName(String value) => _importThesaurusName.value = value;

  List<ThesaurusItemDTO> get thesaurusItem => _thesaurusItem.value;

  /// 当前词条分类的所有内容
  set thesaurusItem(List<ThesaurusItemDTO> value) => _thesaurusItem(value);

  String get thesaurusKeyWord => _thesaurusKeyWords.value;

  /// 词条库关键字搜索
  set thesaurusKeyWord(String value) => _thesaurusKeyWords.value = value;

  List<ThesaurusItemDTO> get vocabularyCard => _vocabularyCard.value;

  /// 词条卡片
  set vocabularyCard(List<ThesaurusItemDTO> value) => _vocabularyCard(value);

  ThesaurusItemDTO get vocabularyCardItem => _vocabularyCardItem.value;

  /// 当前词条描述和结论
  set vocabularyCardItem(ThesaurusItemDTO value) =>
      _vocabularyCardItem.value = value;
}
