#pragma once

#include <QObject>
#include <QString>
#include <memory>

namespace softbus::api::http
{

class RestApiServer final : public QObject
{
    Q_OBJECT

public:
    explicit RestApiServer(QObject* parent = nullptr);
    ~RestApiServer() override;

    /// Reads `api.http` from JSON config. If disabled or missing, returns true and does nothing.
    /// If enabled but listen/bind fails, returns false and sets err.
    bool tryStartFromConfigFile(const QString& configPath, QString* err = nullptr);

    void stop();

private:
    struct Impl;
    std::unique_ptr<Impl> m_impl;
};

} // namespace softbus::api::http
