#pragma once
// ext_state_io — the ext-state <-> JSON serialization half of the persist seam.
// This header owns the persist-side key spellings and the channel-derived
// namespace accessor; ext_state_io.cpp implements the session's save/load/
// assignment-request bridge plus GUID minting and bank-folder relocation.
//
// The namespace + wire-shared key names are the contract with the VST3
// instrument; they live in ext_keys.h (pure, REAPER-free), included here, not
// duplicated. Channel-derived: "reasampler" on stable, "reasampler_beta" on
// beta — a project saved by stable shows empty/default state in beta and vice
// versa; that isolation is deliberate.
//
// Per-key semantics (spellings owned by ext_keys.h): kProjExtBanksKey is the
// whole serialized BankBook, authoritative; kProjExtIndexKey is the retired
// legacy single-bank key (read once to migrate); kProjExtViewKey/TailKey are
// the Design-View and tail JSON; kProjExtGuidKey is the per-project minted
// GUID poll() uses to tell Save-As from a recycled-pointer switch. All are
// FOREVER-STABLE once shipped.

#include "core/version/app_version.h"
#include "ext_keys.h"

namespace reasampler {

// Accessor, not a literal, because the string is channel-derived at build time.
inline const char* projExtNamespace() { return version::extStateNamespace().c_str(); }

// Extension-only keys — not part of the VST wire contract, so they live here
// rather than in ext_keys.h.

// Project-relative files the capture path itself created, consumed by prune
// to tell the bank system's own orphans from hand-dropped files. A sibling
// key, not folded into `banks`. FOREVER-STABLE.
inline constexpr const char* kProjExtOwnedKey = "owned_files";

// The ReaSampler version that last wrote this project. An absent key is the
// pre-versioning case, read silently. FOREVER-STABLE.
inline constexpr const char* kProjExtVersionKey = "version";

}  // namespace reasampler
