#ifndef EDCLOCK_H
#define EDCLOCK_H

#include <QPainter>
#include <QTextDocument>
#include <QTimeZone>
#include <QDate>
#include <QTime>
#include <QTimer>
#include "ebase.h"

class EDClock : public EBase {
    Q_OBJECT
public:
    struct Data {
        QByteArray timeZoneId;
        QFont font;
        QColor textColor;
        bool       year;
        bool       month;
        bool       day;
        bool       hour;
        bool       min;
        bool       sec;
        bool       weekly;
        bool       fullYear;
        bool       hour12;
        bool       AmPm;
        bool       multiline;
        int        dateStyle;
        int        timeStyle;
        int        playDuration = 10;
    };

    explicit EDClock(EBase *multiWin = nullptr);
    explicit EDClock(const QJsonObject &json, EBase *multiWin = nullptr);

    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
    int type() const override { return EBase::DClock; }
    QWidget* attrWgt() override;
    QJsonObject attrJson() const override;

private:
    void init();

    Data m_attr;
    QString img_dir;
    QDateTime datetime;
    bool isSingleMD = false;
};

#endif // EDCLOCK_H
