library;

import 'dart:typed_data';

import 'package:wolf_3d_dart/wolf_3d_data_types.dart';

/// Host adapter contract for slot-based save-game persistence.
abstract class SaveGamePersistence {
  /// Loads raw bytes for [slot] and [version], or `null` when no save exists.
  Future<Uint8List?> load({required int slot, required GameVersion version});

  /// Returns whether a non-empty save exists for [slot] and [version].
  Future<bool> exists({required int slot, required GameVersion version}) async {
    final Uint8List? bytes = await load(slot: slot, version: version);
    return bytes != null && bytes.isNotEmpty;
  }

  /// Persists [bytes] for [slot] and [version].
  Future<void> save({
    required int slot,
    required GameVersion version,
    required Uint8List bytes,
  });
}
