#pragma once #include "network/api_client.h" #include namespace radiantwave::sync { // The on-disk schedule cache. Stores the target payload plus its ETag as a JSON // document. Writes are atomic (temp file + rename) so a crash or power loss // never leaves a partially written cache. namespace schedule_cache { // Absolute path of the cache file (under ~/.local/radiantwave/). std::string cachePath(); // Serialize `payload`/`etag` to the cache file atomically. Returns false on // any I/O failure; the previous cache is left intact. bool write(const api::SchedulePayload& payload, const std::string& etag); // Load the cache. Returns false (and leaves `out` untouched) when the file is // missing, unreadable, malformed, or semantically invalid. bool read(api::SchedulePayload& out, std::string& outEtag); // Remove the cache file. Returns true when absent afterwards. bool clear(); } // namespace schedule_cache } // namespace radiantwave::sync