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});

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

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

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

  Future<void> clear(String boxName);

  Future<void> close(String boxName);

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

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

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