#ifndef WPLANITEM_H
#define WPLANITEM_H

#include <QWidget>
#include <QListWidgetItem>
#include <QJsonValue>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonDocument>

namespace Ui {
class wPlanItem;
}

class wPlanItem : public QWidget
{
    Q_OBJECT

public:
    explicit wPlanItem(QListWidgetItem *item, QWidget *parent = nullptr);
    explicit wPlanItem(const QJsonObject &oRoot, QListWidgetItem *item, QWidget *parent = nullptr);
    ~wPlanItem();

    void setNum(int n);
    void setPlan(const QJsonObject &oRoot);
    QJsonObject planJson() const;

private:
    void initBegin();
    void initEnd();

signals:
    void sigItemChanged(QListWidgetItem *);
    void sigDelete(QListWidgetItem *);

protected slots:
    void onItemChanged();
    void onDelete(bool);

private:
    Ui::wPlanItem *ui;
    QListWidgetItem *m_item;
};

#endif // WPLANITEM_H
