#pragma once

#include <nlohmann/json.hpp>

#include <optional>
#include <string>

namespace lm {

class MapStore;
class PathStore;

class PathService
{
public:
  PathService(PathStore& paths, MapStore& maps);

  nlohmann::json getOrCreatePath(const std::string& map_id,
                                 const std::string& site_id,
                                 const std::string& from_position_id,
                                 const std::string& to_position_id,
                                 std::string& err);

  void invalidateMapPositions(const nlohmann::json& old_map, const nlohmann::json& new_map);

  nlohmann::json pathsBetweenPositions(const std::string& map_id,
                                       const std::string& from_position_id,
                                       const std::string& to_position_id) const;

private:
  PathStore& paths_;
  MapStore& maps_;
};

}  // namespace lm
