#pragma once

#include "StateEstimator_Interface.hpp"

#include <string>
#include <string_view>

enum class ControlMode : uint8_t
{
	NONE = 0,
	PRESSURE,
	VELOCITY,
	PRESSURE_VELOCITY
};

class Platform_Controller
{
  public:
	Platform_Controller(std::string id);

	virtual void start(const stateEstimate_t initial) = 0;
	virtual void stop() = 0;
	virtual void sleep() = 0;

	virtual float update(const stateEstimate_t currentEst,
		const float targetPressure_dBar,
		const bool parkAtTargetPressure,
		const float velocityDesired_dBar_s,
		const ControlMode ctrlMode) = 0;

	// Contstrain inVal to +/- absLimitVal
	float constrainValueSymetric(const float inVal, const float absLimitVal);

	static constexpr float DEFAULT_MAX_TARGET_PRESSURE_DBAR = 500.0;
	static constexpr float DEFAULT_PRESSURE_SPEED_DBAR_PER_SEC = 1.0;

  protected:
	virtual ~Platform_Controller() = default;
	const std::string_view id_;
};