import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/model/description.dart';

class DescriptionRepository {
  List<Description>? descriptions;

  DescriptionRepository() {
    this.descriptions = Cache().getDescriptions();
  }

  String getDescriptionByName(String name) {
    String descriptionText = "";
    if (descriptions != null) {
      this.descriptions!.forEach((element) {
        print("Desc ${element.name} - $name");
        if (element.name == name) {
          descriptionText = element.descriptionTranslation != null ? element.descriptionTranslation! : element.description;
        }
      });
    }
    return descriptionText;
  }
}
