#pragma once
// Managed/manual fixed-lane convention: maps a lane's durable P_LANENAME to the
// opaque lane-key view_mode_model keys by. See src/core/view/CLAUDE.md (Gotchas):
// lane identity must ride the durable name, never the raw I_FIXEDLANE ordinal,
// or a reorder silently corrupts managed/manual ownership.

#include <optional>
#include <string>

namespace reasampler::view {

// Prefix stamped on every lane name the tool mints. Stable-forever like an
// action-id string — changing it strands ownership of every already-minted lane.
inline constexpr const char* kManagedLanePrefix = "reasampler:";

bool isManagedLaneName(const std::string& laneName);

// A managed lane's key is its full durable name; nullopt for manual/unnamed.
std::optional<std::string> managedLaneKey(const std::string& laneName);

// Inverse pair: managedLaneKey(laneNameForMode(m)) == kManagedLanePrefix + m;
// modeIdFromLaneName(laneNameForMode(m)) == m.
std::string laneNameForMode(const std::string& modeId);
std::optional<std::string> modeIdFromLaneName(const std::string& laneName);

// Single predicate governing both which lanes the apply path may drive and
// which items are exempt from auto-tag. No manual-lane concept on a non-fixed-
// lane track (returns false); on a fixed-lane track, any unprefixed name —
// including REAPER's default empty lane — is manual.
bool isOnManualLane(bool isFixedLaneTrack, const std::string& laneName);

}  // namespace reasampler::view
