#include "agentty/runtime/app/deps.hpp"

#include <stdexcept>

namespace agentty::app {

namespace {
Deps* g_deps = nullptr;
}

const Deps& deps() {
    if (!g_deps) throw std::logic_error("agentty::app::deps() called before install_deps()");
    return *g_deps;
}

void install_deps(Deps d) {
    static Deps storage;
    storage = std::move(d);
    g_deps = &storage;
}

void update_auth(auth::AuthHeader auth) {
    if (!g_deps) return;
    g_deps->auth = std::move(auth);
}

} // namespace agentty::app
