#ifndef SENSORWIDGET_H
#define SENSORWIDGET_H

#include <QFrame>
#include <QLabel>
#include <QVBoxLayout>
#include "getsensors_r.h"

class SensorWidget : public QFrame
{
    Q_OBJECT

public:
    explicit SensorWidget(QWidget *parent = nullptr, const Sensor &sensor = Sensor());

    void setErrorState();

    Sensor getSensor() const;
    void setSensor(const Sensor value);

signals:
    void clicked(SensorWidget *sensor);

protected:
    void mousePressEvent(QMouseEvent *event) override;

private:
    Sensor sensor;
    QLabel *titleLabel;
    QLabel *valueLabel;
    QLabel *incidentLabel;
    QVBoxLayout *layout;
};

#endif // SENSORWIDGET_H
