import 'dart:collection';

class TrainingPlanDay {
  late int dayId;
  late String name;

  HashMap<String, String> nameTranslations = HashMap();

  TrainingPlanDay.fromJson(Map json) {
    this.dayId = json['dayId'];
    this.name = json['name'];

    nameTranslations['en'] = name;
    if (json['translations'] != null && json['translations'].length > 0) {
      json['translations'].forEach((translation) {
        nameTranslations[translation['languageCode']] = translation['nameTranslation'];
      });
    }
  }

  Map<String, dynamic> toJson() => {
        "dayId": this.dayId,
        "name": this.name,
        "nameTranslation": this.nameTranslations.toString(),
      };

  @override
  String toString() => this.toJson().toString();
}
