import 'models.dart'; import 'fixtures.dart'; /// Repository abstraction for evaluations. /// /// Phase 0 ships exactly one implementation: [MockRepository], /// backed by [Fixtures]. The live implementation (gRPC against a /// running `chain serve`) lands in Phase 0 week 1 — its API will /// match this interface so no UI change is needed. abstract class EvaluationRepository { Future> list(); Future byEli(String eli); String get mode; String get hubLabel; } /// In-memory, no-network implementation. Marks itself clearly so /// the UI shows a "demo mode" badge. class MockRepository implements EvaluationRepository { const MockRepository(); /// Sorted copy of [Fixtures.evaluations], most-harmful first /// (Studie §6 SKM-€/Jahr as harm proxy). The sort is in /// repository.list() rather than the fixture declaration so /// future Hub-fed lists stay consistent without re-tuning the /// UI. @override Future> list() async { final sorted = [...Fixtures.evaluations]; sorted.sort((a, b) => b.skmEurPerYear.compareTo(a.skmEurPerYear)); return sorted; } @override Future byEli(String eli) async { for (final e in Fixtures.evaluations) { if (e.norm.eli == eli) return e; } return null; } @override String get mode => 'demo'; @override String get hubLabel => 'in-memory fixtures (kein Hub)'; }