import 'package:flutter/foundation.dart';
import 'package:hive_ce/hive.dart';

abstract class ILocalStorage<E> {
  Future<void> init();

  Future<void> openBox<T>(
    String boxName, {
    HiveCipher? encryptionCipher,
    bool crashRecovery = true,
    String? path,
    Uint8List? bytes,
    String? collection,
  });

  T? read<T>({required String boxName, required String key});

  List<T>? readBox<T>({required String boxName});

  Future<void> deleteValue<T>({required String boxName, required String key});

  Future<void> add<T>({required String boxName, required E value});

  Future<void> addAll<T>({required String boxName, required Iterable<E> values});

  Future<void> clear(String boxName);

  Future<void> close(String boxName);

  Future<void> save<T>({required String boxName, required String key, required dynamic value});

  Future<void> saveAt<T>({required String boxName, required int index, required dynamic value});

  Future<void> saveAll<T>({required String boxName, required Map<dynamic, E> entries});
}
