#pragma once

#include "api.h"
#include <QObject>

namespace http {

#define HTTPProxyInterfaceIID "bigsnitch.api.HTTPProxyInterface/100"

//! Interface for implementing proxies
/*!
  Interface for implementing proxies

  You need to implement the following signals:

    void process(std::string path); // called in a separate thread, has to block, will not be called again
    void finished(); // thread finished and can be deleted
    void error(QString err); // an error occured
    void message(http::Flow flow); // a http::Flow was received

*/
class ProxyInterface {
public:
    // the path the proxy listens on
    std::string path;
    virtual ~ProxyInterface() = default;
    //! returns name of the plugin
    virtual QString getName() = 0;
    //! returns, whether the proxy is currently connected
    virtual bool connected() = 0;
    //! disconnects the handle
    virtual void disconnect() = 0;
    // options/settings
};

}

Q_DECLARE_INTERFACE(http::ProxyInterface, HTTPProxyInterfaceIID)