import 'package:ambito/src/entity/measure/details/measure_details.dart';
import 'package:isar/isar.dart';

import '../../../consts/consts.dart';
import '../../../packages/ambito_db/base_db.dart';

class MeasureDetailsRepository extends BaseDB {
  @override
  IsarCollection collection = isar.measureDetails;

  MeasureDetails? getDetailsForMeasure(String measure) {
    List<MeasureDetails> all = isar.measureDetails.where().findAll();
    return all
        .where(
            (el) => el.measure!.map((m) => m.value).toList().contains(measure))
        .firstOrNull;
  }
}
