import 'package:fis_jsonrpc/rpc.dart';
import 'package:flyinsono/views/desktop/index.dart';
import 'package:get/get.dart';

class FConsultationState {
  final RxList<ConsultationsRecordCard> _consultationsRecordCardList =
      RxList(<ConsultationsRecordCard>[]);
  final RxString _keyWord = RxString('');
  final RxDouble _score = RxDouble(0);
  final Rx<String> _gradeDescription = Rx("");
  final RxInt _currentIndex = RxInt(0);
  final RxInt _currentFollowUpIndex = RxInt(0);
  final RxBool _isFollowUpInfoListEmpty = RxBool(false);
  final Rx<ConsultationDetailDTO?> _currentConsultationDetail =
      Rx<ConsultationDetailDTO?>(null);
  final RxList<ConsultationImagesDTO> _currentConsultationImages =
      RxList<ConsultationImagesDTO>();
  final Rx<List<ReportDTO>> _reportList = Rx(<ReportDTO>[]);
  final RxString _reportCode = RxString('');
  final Rx<ReportDTO> _reportInfo = Rx(ReportDTO());
  final Rx<int> _reportIndex = Rx(0);
  final RxList<String> _selectedImages = RxList([]);

  ///选择图像
  List<String> get selectedImages => _selectedImages.value;
  set selectedImages(List<String> v) => _selectedImages.value = v;

  ///报告位置
  int get reportIndex => _reportIndex.value;
  set reportIndex(int index) => _reportIndex.value = index;

  ///当前报告
  ReportDTO get reportInfo => _reportInfo.value;
  set reportInfo(ReportDTO v) => _reportInfo.value = v;

  /// 选中报告Code
  set reportCode(String value) => _reportCode.value = value;
  String get reportCode => _reportCode.value;

  ///会诊随访信息
  final RxList<FollowUpVisitDTO> _followUpVisistInfoList =
      RxList(<FollowUpVisitDTO>[]);

  ///当前所选会诊的图像集合
  List<ConsultationImagesDTO> get currentConsultationImages =>
      _currentConsultationImages;
  set currentConsultationImages(List<ConsultationImagesDTO> v) =>
      _currentConsultationImages.value = v;

  /// 报告列表
  set reportList(List<ReportDTO> value) => _reportList(value);
  List<ReportDTO> get reportList => _reportList.value;

  ///随访列表
  List<FollowUpVisitDTO> get followUpVisistInfoList => _followUpVisistInfoList;
  set followUpVisistInfoList(List<FollowUpVisitDTO> v) =>
      _followUpVisistInfoList.value = v;

  int get currentFollowUpIndex => _currentFollowUpIndex.value;
  set currentFollowUpIndex(int v) => _currentFollowUpIndex.value = v;

  ///随访列表为空
  bool get isFollowUpInfoListEmpty => _isFollowUpInfoListEmpty.value;
  set isFollowUpInfoListEmpty(bool v) => _isFollowUpInfoListEmpty.value = v;

  ///会诊评价详情
  final Rx<ConsultationEvaluateDTO?> _consultationEvaluateDetail =
      Rx<ConsultationEvaluateDTO?>(null);

  ConsultationDetailDTO? get currentConsultationDetail =>
      _currentConsultationDetail.value;
  set currentConsultationDetail(ConsultationDetailDTO? v) =>
      _currentConsultationDetail.value = v;

  ///搜索关键字
  String get keyWord => _keyWord.value;
  set keyWord(String v) => _keyWord.value = v;

  ///会诊评分
  double get score => _score.value;
  set score(double v) => _score.value = v;

  ///评价 好/中/差
  String get gradeDescription => _gradeDescription.value;
  set gradeDescription(String val) => _gradeDescription.value = val;

  ConsultationEvaluateDTO? get consultationEvaluateDetail =>
      _consultationEvaluateDetail.value;
  set consultationEvaluateDetail(ConsultationEvaluateDTO? v) =>
      _consultationEvaluateDetail.value = v;

  /// 预约会诊卡片列表
  List<ConsultationsRecordCard> get consultationsRecordCardList =>
      _consultationsRecordCardList;
  set consultationsRecordCardList(List<ConsultationsRecordCard> val) =>
      _consultationsRecordCardList.value = val;

  ///当前选中卡片位置
  int get currentIndex => _currentIndex.value;
  set currentIndex(int index) => _currentIndex.value = index;

  ///当前所选会诊信息
  ConsultationsRecordCard get currentConsultation =>
      consultationsRecordCardList[_currentIndex.value];

  String get consultationCode => currentConsultation.consultationCode;

  ///差评和中评的分界线
  double bad = 1.5;

  ///中评和好评的分界线
  double good = 3.5;
}
