#pragma once
#include <QTimer>
#include "actor.h"

class TimerActor: public Actor
{
	Q_OBJECT
private:
	int timeoutMsec_;

	QTimer timer;

private slots:

	void timeout();

public slots:

	virtual void onItemUpdated(ItemUpdateRequest update) override;
	void setTimeout(const int timeoutSec);

public:
	explicit TimerActor(const int timeoutSec = 60, QObject *parent = nullptr);
	virtual QString getName() const override;

	int getTimeout();

	virtual void store(QJsonObject& json) override;
	virtual void load(const QJsonObject& json, bool preserve) override;
};
