#pragma once

#include <cstdint>
#include <functional>
#include <memory>
#include <string>

struct UA_Server;

namespace softbus::opcua {

struct SecurityConfig {
    bool enableTls{false};
    std::string certPath;
    std::string keyPath;
    std::string trustListPath;
};

class UaServerEngine {
public:
    UaServerEngine();
    ~UaServerEngine();

    UaServerEngine(const UaServerEngine&) = delete;
    UaServerEngine& operator=(const UaServerEngine&) = delete;

    bool start(uint16_t port, const std::string& applicationName, const SecurityConfig& security);
    void stop();
    void iterate();
    bool isRunning() const { return running_; }

    UA_Server* nativeServer() { return server_; }

private:
    UA_Server* server_{nullptr};
    bool running_{false};
    SecurityConfig security_;
};

} // namespace softbus::opcua
