#pragma once

#include <nlohmann/json.hpp>

#include <optional>
#include <string>

namespace lm {

class SensorValidator
{
public:
  static bool validateLidarPayload(const nlohmann::json& payload, std::string& err);
  static bool validateImuPayload(const nlohmann::json& payload, std::string& err);

  static bool lidarTripletExists(const nlohmann::json& state,
                                 const std::string& name,
                                 const std::string& ip,
                                 int port,
                                 const std::string* exclude_id = nullptr);

  static bool imuFrameExists(const nlohmann::json& state,
                             const std::string& frame_id,
                             const std::string* exclude_id = nullptr);

  static std::optional<size_t> findLidarIndex(const nlohmann::json& state, const std::string& id);
  static std::optional<size_t> findImuIndex(const nlohmann::json& state, const std::string& id);
};

}  // namespace lm
