import 'package:app_hit_a_wod/src/models/exercise.model.dart';
import 'package:app_hit_a_wod/src/models/training_workout.model.dart';
import 'package:app_hit_a_wod/src/models/user_benchmark.model.dart';
import 'package:json_annotation/json_annotation.dart';

part 'bi_exercises.model.g.dart';

@JsonSerializable()
class BIExercise {

  BIExercise();

  factory BIExercise.fromJson(Map<String, dynamic> json) => _$BIExerciseFromJson(json);
  Map<String, dynamic> toJson() => _$BIExerciseToJson(this);

  int id;
  String name;
  String slug;
  String description;
  String modality;
  String type;
  String equipment_type;
  int level;
  String url_video_predefined;
  DateTime created_at;
  DateTime updated_at;
  List<UserBenchmark> benchmarks;
  List<TrainingWorkout> workouts;
  List<Map<String,dynamic>> graph;

  toExercise() {
    Exercise e = new Exercise();
    e.id = this.id;
    e.name = this.name;
    e.slug = this.slug;
    e.description = this.description;
    e.modality = this.modality;
    e.type = this.type;
    e.equipment_type = this.equipment_type;
    e.level = this.level;
    e.url_video_predefined = this.url_video_predefined;
    e.created_at = this.created_at;
    e.updated_at = this.updated_at;
    return e;
  }

}