#pragma once

#include <softbus_bus/Bus.h>

#include <string>

struct UA_Server;

namespace softbus::opcua {

class UaEventBridge {
public:
    explicit UaEventBridge(UA_Server* server);

    void emitHeartbeat(const std::string& objectRef);
    void emitDeviceOnline(const std::string& stableDeviceKey);
    void emitDeviceOffline(const std::string& stableDeviceKey);
    void emitParseError(const std::string& objectRef, const std::string& detail);
    void attachBus(softbus::bus::Bus* bus);

private:
    void onBusMessage(const softbus::bus::BusMessage& message);

    UA_Server* server_{nullptr};
    softbus::bus::Bus* bus_{nullptr};
    softbus::bus::Bus::SubscriptionId eventSub_{0};
};

} // namespace softbus::opcua
