#ifndef __HTTPSERVER_H__
#define __HTTPSERVER_H__

#include <QObject>
#include <httplib.h>
#include <stdint.h>
#include <QThread>

class HttpServer : public QObject
{
    Q_OBJECT

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

    std::string addr() const;
    uint16_t port() const;
    bool isRunning() const;
    void run(const char *addr, unsigned short port);
    void stop();

private:
    std::string m_addr;
    uint16_t m_port;
    httplib::Server m_server;
    QThread m_thread;

signals:
    void monitorConfigureUpdate(const QString &filename);
    void netparseConfigureUpdate(const QString &filename);
    void formulaConfigureUpdate(const QString &filename);
    void upgradePlugin();
    void reloadCanvas();

private slots:
    void run_hhttp_sever();

};

#endif // HTTPSERVER_H