#pragma once

#include <nlohmann/json.hpp>

#include <mutex>
#include <optional>
#include <string>

namespace lm {

class Database;

class DashboardStore
{
public:
  explicit DashboardStore(Database& db);

  nlohmann::json snapshot() const;
  bool replace(const nlohmann::json& payload, std::string& err);

private:
  Database& db_;
  mutable std::mutex mu_;

  void ensureDefaultsUnlocked();
};

}  // namespace lm
