#pragma once

#include <QObject>
#include <QLocalSocket>
#include "../TradeCore/message.hh"

/**
 * @brief Client connection class
 * Parsing, serializing, sending and receiving of messages.
 */
class Connection : public QObject
{
    Q_OBJECT

public:
    explicit Connection(QObject* parent = nullptr);
    QString socketError() const;
    bool connect(const QString& serverName);
    bool sendMessage(const Message& message);
    Message readMessage();

private:
    QLocalSocket socket_;
};
