//
// Project Global Settings
//

#ifndef PROJGLOBALS_H
#define PROJGLOBALS_H

#include <ESP8266WebServer.h>

// Manage the WiFi Configuration, AP, SSID, etc.
#include "WiFiConfiguration.h"

typedef enum {
	DrumIsOpen,
	DrumIsClosed,
	DrumIsMoving,
	DrumIsStuck,
} DrumState_E;

typedef enum {
	DrumOff,
	DrumCW,
	DrumCCW
} DrumMotor_E;

typedef struct {
	uint32_t SecondsToday;		// elapsed seconds from midnight (for simulation)
	bool Fahrenheit;			// Show temp in Fahrenheit.

	float ChamberTemp_C;		// Chamber Temp
	float ChamberHumi;	// Chamber Humidity - if installed

	bool SoilHeater;
	float SoilTemp_C;			// Soil Temp - if installed
	float SoilMoisture_X;		// Soil Moisture - unitless number, if installed

	float AmbientTemp_C;		// 

	DrumState_E DrumDoorIcon;		// Current State: open/close/moving
	bool DrumOpenSensor;
	bool DrumClosedSensor;
	DrumMotor_E DrumMotorStatus;		// Off, CW, CCW
	uint32_t DrumMotorOn_sec;
	float DrumMotor_V;
	float DrumMotor_I;

	bool WaterInTank;					// controls image of the WaterLevelIcon
	bool WaterPumpStatus;				// WaterLevelIcon pump on
	float WaterMotor_V;
	uint32_t WaterCyclePeriod_sec;	// Total Time (allows WaterLevelIcon to soak in)
	uint32_t WaterCycleOn_sec;	// WaterLevelIcon Pump on time
	uint32_t WaterCycle_sec;	// Running timer
} PlantData_T;


extern void FactoryReset(bool forceRestart);
extern const String AP_NAME;
extern const String AP_VERS;
// extern bool isStationMode;
extern ESP8266WebServer server;
extern ConfigManager wifiConfig;

extern PlantData_T plant;			/// This keeps track of everything relevant to this system
extern bool updateCheck;

#endif // PROJGLOBALS_H
