#pragma once

#include <QScopedPointer>
#include <DSingleton>
#include <QNetworkRequest>
#include <curl/curl.h>

#include "commonsystemdetector.h"

class LegalizationAgent;
class NetworkAgentPrivate;
class NetworkAgent: public Dtk::Core::DSingleton<NetworkAgent>
{
public:
    NetworkAgent();
    ~NetworkAgent();

    QNetworkRequest createRequest(const QUrl &url) const;
    struct curl_slist *customCurlHeader() const;

    QString clientPlatform() const;
    void setSystemDetector(CommonSystemDetector *, LegalizationAgent*);

private:
    friend class Dtk::Core::DSingleton<NetworkAgent>;
    QScopedPointer<NetworkAgentPrivate> dd_ptr;
    Q_DECLARE_PRIVATE_D(qGetPtrHelper(dd_ptr), NetworkAgent)
};

