
#ifndef TRIGGERWIDGET_H
#define TRIGGERWIDGET_H

#include <QWidget>
#include <QCheckBox>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <eismultiplexer.h>
#include <memory>

class TriggerWidget : public QWidget
{
    Q_OBJECT

public:
    explicit TriggerWidget(uint16_t deviceSerial, uint16_t triggerNumber,
                           std::shared_ptr<struct eismultiplexer> multiplexer,
                           QWidget *parent = nullptr);
    ~TriggerWidget() override;

    uint16_t getDeviceSerial() const;
    uint16_t getTriggerNumber() const;
    void updateSate(uint16_t serial, uint16_t trigger, trigger_state_t state);

private slots:
    void onInputToggled(bool checked);
    void onLevelToggled(bool checked);
    void updateTriggerState();

private:
    uint16_t deviceSerial;
    uint16_t triggerNumber;
    std::shared_ptr<struct eismultiplexer> multiplexer;
    QCheckBox inputCheckbox;
    QCheckBox levelCheckbox;
    QLabel devicelabel;
    QLabel triggerlabel;
    QFrame line;
    QVBoxLayout vlayout;
    QHBoxLayout hlayout;
    QVBoxLayout labellayout;
};

#endif // TRIGGERWIDGET_H
