#ifndef TACTILEIPC3D_SERIAL_MANAGER_H
#define TACTILEIPC3D_SERIAL_MANAGER_H

#include <QHash>
#include <QString>
#include <memory>

#include "serial_codec.h"
#include "serial_decoder.h"
#include "serial_format.h"

class SerialManager {
public:
    struct ProtocolBundle {
        std::shared_ptr<ISerialCodec> codec;
        std::shared_ptr<ISerialDecoder> decoder;
        std::shared_ptr<ISerialFormat> format;
    };

    void registerProtocol(const QString& name, const ProtocolBundle& bundle);
    bool setActiveProtocol(const QString& name);

    QString activeProtocol() const { return m_activeName; }
    ProtocolBundle activeBundle() const;

private:
    QHash<QString, ProtocolBundle> m_protocols;
    QString m_activeName;
};

#endif // TACTILEIPC3D_SERIAL_MANAGER_H
