#ifndef ALARMWIDGET_H
#define ALARMWIDGET_H

#include "sensorservice.h"

#include <QFrame>
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWidget>

class AlarmWidget : public QWidget
{
    Q_OBJECT

public:
    explicit AlarmWidget(QMap<QString, QMap<QString, QPair<QString, QString>>> &translate,
                         const QString &sensorId = "",
                         const QString &group = "",
                         const QString &date = "",
                         const QString &time = "",
                         const QString &timeEnd = "",
                         SensorService *sensorService = nullptr,
                         QWidget *parent = nullptr);

private:
    QLabel *createLabel(const QString &text, int minSize = 100, int maxSize = 250);

signals:
    void dialogClosedFromWidget(QString groupWithSensor, QDateTime start, QDateTime end);

private slots:
    void onInfoButtonClicked();
    void onDialogClosed();

private:
    QMap<QString, QMap<QString, QPair<QString, QString>>> _translate;
    const QString _timeEnd;
    const QString _sensorId;
    SensorService *_sensorService;
    QLabel *groupLabel;
    QLabel *sensorLabel;
    QLabel *dateLabel;
    QLabel *timeLabel;
    QPushButton *infoButton;
};

#endif // ALARMWIDGET_H
