import 'dart:collection';

class Sport {
  late int sportId;
  late String name;

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

  Sport.fromJson(Map json) {
    this.sportId = json['sportId'];
    this.name = json['name'];

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

  Map<String, dynamic> toJson() => {
        "sportId": sportId,
        "name": name,
      };

  @override
  String toString() {
    return this.toJson().toString();
  }
}
