import 'package:fis_jsonrpc/rpc.dart';
import 'package:flyinsono/lab/mock_data/mock_rpc.dart';
import 'package:flyinsono/lab/pages/lab_image/urm_data_processor/urm_params.dart';
import 'package:flyinsono/lab/pages/lab_image/widgets/image_measure_overlay/widgets/rim_measure_result_table.dart';
import 'package:flyinsono/lab/pages/lab_image/widgets/image_operate_panel/controller.dart';
import 'package:fis_measure/view/measure/measure_config/measure_configuation_page.dart';
import 'package:fis_jsonrpc/rpc.dart' hide DRect;
import 'dart:async';
import 'package:fis_measure/process/workspace/urm/application.dart';

abstract class IMeasureManager {
  /// 获取测量项
  Future<MeasureApplicationDTO?> getMeasureApplicationAsync({
    required MeasureModeSelection measureModeSelection,
  });

  List<MeasureItemInfo> getMeasureItems({
    required List<MeasureModeDTO> measureModeList,
    required String modeName,
    required bool isUrmMrasure,
  });

  List<String> chooseMeasureList({
    required List<MeasureModeDTO> measureModeList,
    required String modeName,
  });

  /// 获取URM测量项
  List<URMMeasureItem> getURMMeasureItems({
    required List<MeasureModeDTO> measureModeList,
  });

  MeasureConfigItem measureConfig({
    required List<MeasureModeDTO> availableModes,
    required List<MeasureItemCategory> measureItemCategories,
    required int selectedCategoryIndex,
  });

  List<ItemMetaDTO> setMeasureConfigItemMetaList({
    required List<MeasureModeDTO> availableModes,
    required List<MeasureItemCategory> measureItemCategories,
    required int selectedCategoryIndex,
  });

  Future<URMColorbarResult?> getURMColorbar({
    required int processType,
    PostProcessImageParams? postProcessImageParams,
    ProcessPosParams? processPosParams,
    String? remedicalCode,
    List<UrmPoint>? urmTraceDPoints,
    String? urmImageType,
    int? urmBlend,
    int? imgProcessVer,
    bool? zoomOn,
  });

  List<RimMeasureRowResult> handleMesureresult({
    URMRimMesureResult? mesureresult,
  });

  ///获取应用的体标配置项请求
  Future<BodyPatternsResult?> getBodyPatternsByApplication({
    String? applicationName,
    String? categoryName,
    String languageCode = 'zh-CN',
  });

  ///用户自定义保存体标项请求
  Future<bool> saveUserDefinedBodyPattern({
    required String applicationName,
    required String categoryName,
    String? category,
    String? description,
    List<String> imageUrlList = const [],
  });

  ///重置用户体标数据
  Future<bool> resetUserBodyPatterns({
    required String applicationName,
    required String categoryName,
    bool isAllReset = false,
  });

  Future<CommentItemResultDTO?> getCommentsByApplicationAsync(
    String applicationName,
    String categoryName,
  );
}

class URMMeasureItem {
  List<MeasureItemInfo> urmMeasureItems;
  String urmName;
  URMMeasureItem({
    required this.urmMeasureItems,
    required this.urmName,
  });
}

class MeasureConfigItem {
  List<ItemMetaGroup> itemMetaListGroup;
  List<String> chooseMeasure;
  MeasureConfigItem({
    required this.itemMetaListGroup,
    required this.chooseMeasure,
  });
}
