#pragma once

#include <cstdint>
#include <filesystem>
#include <string>

enum class PersistenceTargetKind
{
	RuntimeState,
	StackPreset,
	RuntimeConfig
};

struct PersistenceRequest
{
	PersistenceTargetKind targetKind = PersistenceTargetKind::RuntimeState;
	std::string reason;
	std::string debounceKey = "runtime-state";
	bool debounceAllowed = true;
	bool flushRequested = false;
	uint64_t sequence = 0;

	static PersistenceRequest RuntimeStateRequest(const std::string& reason)
	{
		PersistenceRequest request;
		request.targetKind = PersistenceTargetKind::RuntimeState;
		request.reason = reason;
		request.debounceKey = "runtime-state";
		request.debounceAllowed = true;
		return request;
	}
};

struct PersistenceSnapshot
{
	PersistenceTargetKind targetKind = PersistenceTargetKind::RuntimeState;
	std::filesystem::path targetPath;
	std::string contents;
	std::string reason;
	std::string debounceKey;
	bool debounceAllowed = false;
	bool flushRequested = false;
	uint64_t generation = 0;
};
