#ifndef DATETIMEWIDGET_H
#define DATETIMEWIDGET_H

#include <QWidget>
#include "global.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class dateTimeWidget;
}
QT_END_NAMESPACE

class QTimer;
class DateTimeSelectionPanel;
class DateTimeWidget : public QWidget
{
    Q_OBJECT

public:
    DateTimeWidget(QWidget *parent = nullptr);
    ~DateTimeWidget();

    void setDateTime(const QDateTime&);
    void setState(DateTimeWidgetState);
    void setRange(TimeUnit);

protected:
    bool eventFilter(QObject*, QEvent*);

public slots:
    void onBtnClicked_historicalData();
    void onBtnClicked_realTimeData();
    void onBtnClicked_date();
    void onBtnClicked_rangeSelect();
    void onBtnClicked_range();

    void onTimeout_rangeSelect();
    void onTimeout_realTime();

    void onDateTimeSelectResults(QDateTime);

signals:
    void timeRangeChanged(TimeUnit);
    void viewRealTimeData();
    void viewHistoricalData(QDateTime);

    void showMask();
    void hideMask();

private:
    void initialize();

    Ui::dateTimeWidget*  ui;
    QTimer*              m_pTimer_RealTime;
    QTimer*              m_pTimer_Range;
    DateTimeSelectionPanel* m_pSelectionPanel;
};

#endif
