enum ResultItem {
  calorie,
  development_percent_bodypart,
  distance,
  fatburn_percent,
  bpm_avg,
  bpm_min,
  bpm_max,
  speed_max,
  reps_volume,
  steps,
  //time,
  weight_volume
}

extension ResultItemExt on ResultItem {
  static const ResultItemDesc = {
    ResultItem.calorie: "Calorie",
    ResultItem.development_percent_bodypart: "Development in %",
    ResultItem.distance: "Distance",
    ResultItem.bpm_avg: "Average BPM",
    ResultItem.bpm_min: "Min BPM",
    ResultItem.bpm_max: "Max BPM",
    ResultItem.speed_max: "Max speed",
    ResultItem.reps_volume: "Repeats volume",
    ResultItem.steps: "Steps",
    //ResultItem.time: "Time",
    ResultItem.weight_volume: "Weight volume",
    ResultItem.fatburn_percent: "Fatburn %",
  };

  static const ResultItemImg = {
    ResultItem.calorie: "pict_calorie.png",
    ResultItem.development_percent_bodypart: "pic_development_by_bodypart_percent.png",
    ResultItem.distance: "pict_distance_m.png",
    ResultItem.bpm_avg: "pict_hravg_bpm.png",
    ResultItem.bpm_min: "pict_hrmin_bpm.png",
    ResultItem.bpm_max: "pict_hrmax_bpm.png",
    ResultItem.speed_max: "pict_maxspeed_kmh.png",
    ResultItem.reps_volume: "pict_reps_volumen_db.png",
    ResultItem.steps: "pict_steps.png",
    //ResultItem.time: "pict_time_h.png",
    ResultItem.weight_volume: "pict_weight_volumen_tonna.png",
    ResultItem.fatburn_percent: "pict_fatburn_percent.png",
  };

  static const HardwareData = {
    ResultItem.calorie: true,
    ResultItem.development_percent_bodypart: false,
    ResultItem.distance: true,
    ResultItem.bpm_avg: true,
    ResultItem.bpm_min: true,
    ResultItem.bpm_max: true,
    ResultItem.speed_max: true,
    ResultItem.reps_volume: false,
    ResultItem.steps: true,
    //ResultItem.time: false,
    ResultItem.weight_volume: false,
    ResultItem.fatburn_percent: true,
  };

  bool equals(ResultItem item) => this.toString() == item.toString();
  bool equalsString(String item) => this.description == item;

  String? get description => ResultItemDesc[this];
  String? get image => ResultItemImg[this];
  bool? get isHardware => HardwareData[this];

  String? displayString() => description;
}

class ResultExt {
  late final String itemString;
  late ResultItem item;
  double data = 0;
  int? exerciseId;
  DateTime? dateFrom;

  DateTime? dateTo;

  ResultExt({required this.itemString}) {
    ResultItem.values.forEach((element) {
      if (element.equalsString(itemString)) {
        item = element;
      }
    });
  }

  String? getDescription() => item.description;
  String getImage() => "asset/image/" + item.image!;
  bool? isHardware() => item.isHardware;
  int? get getExerciseId => exerciseId;
  set setExerciseId(int exerciseId) => this.exerciseId = exerciseId;
  set setDateFrom(DateTime dateFrom) => this.dateFrom = dateFrom;
  DateTime? get getDateFrom => dateFrom;
  set setDateTo(DateTime dateTo) => this.dateTo = dateTo;
  DateTime? get getDateTo => dateTo;

  bool equals(ResultItem item) => this.item.equals(item);
  bool equalsString(String item) => this.item.equalsString(item);
}
