/// 心电检测数据
class HeartExamData {
  /// 心率
  final int heartRate;

  /// ECG波点集合
  final List<int> ecgPoints;

  HeartExamData({
    required this.heartRate,
    required this.ecgPoints,
  });

  factory HeartExamData.fromEventData(Map<String, dynamic> jsonMap) {
    final pointList = (jsonMap["POINT"] as List).map((e) => e as int).toList();
    return HeartExamData(
      heartRate: jsonMap["HR"],
      ecgPoints: pointList,
    );
  }
}

/// 心电检测结果
class HeartExamResult extends HeartExamData {
  /// 分析结果
  final List<String> analysis;

  HeartExamResult({
    required this.analysis,
    required super.ecgPoints,
    required super.heartRate,
  });

  factory HeartExamResult.fromEventData(Map<String, dynamic> jsonMap) {
    final analysisList =
        (jsonMap["ANALYSIS"] as List).map((e) => e as String).toList();
    return HeartExamResult(
      heartRate: jsonMap["HR"],
      analysis: analysisList,
      ecgPoints: [], //TODO: 暂不返回总点阵
    );
  }
}
