// http_get_json.h — convenience wrapper over fn_http::request for "GET JSON".
//
// Issue 0110. Throws on transport error or non-2xx status. Parses the body
// with nlohmann::json. For full control (POST, custom headers, status
// inspection), use fn_http::request directly.
#pragma once

#include "nlohmann/json.hpp"

#include <stdexcept>
#include <string>

namespace fn_http {

// GET <url>, expect 2xx + JSON body. Throws std::runtime_error on:
//   - transport failure (Response.status == 0)
//   - non-2xx HTTP status
//   - body fails to parse as JSON
//
// `bearer_token` is optional. Pass empty string for unauthenticated.
// `timeout_ms` default 5000.
nlohmann::json get_json(const std::string& url,
                        const std::string& bearer_token = "",
                        int                timeout_ms   = 5000);

} // namespace fn_http
