#pragma once

#include "StateBase.hpp"
#include "StateVariables.hpp"
//#include <bsp.hpp>

class InitPlatformState final : public StateBase
{
public:
	enum Actions : uint8_t
	{
		getGPSTime,
		initTime,
		initLogger,
		readConfigFile,
		readMissionFile,
		initCTD1,
		initBcyEngine,
		initGPS1,
		initIModem1,
		initFLBB1,
		initOptode1,
		initPTH1,
		initMSC1,
		initOCR1,
		runInitPlatformTests,
		runWakeupTests,
		lastAction
	};

public:
	InitPlatformState(uint32_t timeout = 0);

private:
	//StateVariables SV;

	void doThisStateEntry() final;
	void doThisStateExit(bool timeout) final;
	StateNames doStateActions(const StateEvent event) final;
	StateNames checkEvents(const StateEvent event) final;

	/// getGPSTime action handler.
	/// This action tries to get a GPS timestamp. When that is achieved,
	/// it sets the system clock and moves on to the initLogger action.
	StateNames doGetGPSTime(const StateEvent event);

	/// initLogger action handler.
	/// This action initializes the logger on entry.
	/// If successful, it transitions to the SecondState system state.
	/// @pre System clock is set from a GPS timestamp
	/// @post Logger is initialized
	StateNames doInitLogger(const StateEvent event);
	StateNames doReadConfigFile(const StateEvent event);
	StateNames doReadMissionFile(const StateEvent event);
	StateNames doLastAction(const StateEvent event);

	Actions current_action_;
	//GPS& gps_ = getGPS1();
	
	bool hitLastAction = false;
};
