import 'package:vnoteapp/architecture/storage/text_storage.dart';
import 'package:vnoteapp/managers/interfaces/cachedRecord.dart';

class CachedRecordManager implements ICachedRecordManager {
  @override
  Future<bool?> saveCachedRecord(
    String key,
    String patientCode,
    String type,
    String cached,
  ) async {
    TextStorage cachedRecord = TextStorage(
      fileName: key,
      directory: "patient/$patientCode/$type/2023",
    );
    return cachedRecord.save(cached);
  }

  @override
  Future<String?> readCachedRecord(
    String key,
    String patientCode,
    String type,
    String cached,
  ) async {
    TextStorage cachedRecord = TextStorage(
      fileName: key,
      directory: "patient/$patientCode/$type/2023",
    );
    return cachedRecord.read();
  }
}
