feat(domain): add PokemonRepository interface
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
cbc742b25a
commit
42bd9f7c20
22
lib/domain/repositories/pokemon_repository.dart
Normal file
22
lib/domain/repositories/pokemon_repository.dart
Normal file
@ -0,0 +1,22 @@
|
||||
import '../entities/pokemon.dart';
|
||||
|
||||
/// Contrat d'accès aux données Pokémon. L'UI et le domaine ne connaissent que cette interface.
|
||||
abstract interface class PokemonRepository {
|
||||
/// Tous les Pokémon (DB locale d'abord, complétée par l'API si nécessaire).
|
||||
Future<List<Pokemon>> getAll();
|
||||
|
||||
/// Un Pokémon par id (DB d'abord, sinon API + mise en cache). `null` si introuvable.
|
||||
Future<Pokemon?> getById(int id);
|
||||
|
||||
/// Insère/remplace une liste de Pokémon.
|
||||
Future<void> saveAll(List<Pokemon> pokemons);
|
||||
|
||||
/// Met à jour un Pokémon existant.
|
||||
Future<void> update(Pokemon pokemon);
|
||||
|
||||
/// Nombre de Pokémon attrapés.
|
||||
Future<int> caughtCount();
|
||||
|
||||
/// Nombre de Pokémon vus.
|
||||
Future<int> seenCount();
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user