// Platform global accessor implementation
#include "platform.h"
#include <stdexcept>

namespace mosis {

static std::unique_ptr<IPlatform> g_platform;

IPlatform& GetPlatform() {
    if (!g_platform) {
        throw std::runtime_error("Platform not initialized. Call SetPlatform() first.");
    }
    return *g_platform;
}

void SetPlatform(std::unique_ptr<IPlatform> platform) {
    g_platform = std::move(platform);
}

bool HasPlatform() {
    return g_platform != nullptr;
}

} // namespace mosis
