#pragma once

#include <nlohmann/json.hpp>

#include <optional>
#include <string>

namespace lm {

class MapStore;

struct ResolvedPosition
{
  std::string map_id;
  std::string position_id;
  std::string name;
  std::string label;
};

class PositionResolver
{
public:
  explicit PositionResolver(MapStore& maps);

  std::optional<ResolvedPosition> resolve(const std::string& ref, const std::string& prefer_map_id = "") const;
  nlohmann::json listPositions() const;

private:
  MapStore& maps_;
};

std::string getActiveMapIdFromDb(class Database& db);
bool setActiveMapOnRobotRuntimeDoc(class Database& db, const std::string& map_id, std::string& err);

}  // namespace lm
