#ifndef POLYNOMALACTOR_H
#define POLYNOMALACTOR_H
#include "actor.h"
#include "sensors/sensor.h"

class PolynomalActor: public Actor
{
	Q_OBJECT

private:
	Sensor sensor_;
	double pow3_ = 0;
	double pow2_ = 0;
	double pow1_ = 1;
	double pow0_ = 0;

	double prevValue = -1;

public slots:

	void sensorEvent(Sensor sensor, sensor_update_type_t type);

public:

	void setCoeffiancts( const double pow3, const double pow2, const double pow1, const double pow0 );
	void getCoeffiancts( double& pow3, double& pow2, double& pow1, double& pow0 );

	PolynomalActor(const Sensor sensor, QObject* parent = nullptr);
	PolynomalActor(QObject* parent = nullptr);
	void setSensor(const Sensor sensor);
	Sensor getSensor()
	{
		return sensor_;
	}
	virtual QString getName() const;
	virtual ~PolynomalActor() {}

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

#endif // POLYNOMALACTOR_H
