#ifndef __MODSTATEOFCHARGE_H
#define __MODSTATEOFCHARGE_H

#include "stdint.h"
#include "stdbool.h"
#include "modPowerElectronics.h"
#include "modConfig.h"

typedef struct {
	float generalStateOfCharge;
	float generalStateOfHealth;
	float remainingCapacityAh;
	float remainingCapacityWh;
} modStateOfChargeStructTypeDef;


extern float real_capacity;
extern float previous_capacity;
extern float previous_SoC;
//static float current_SoC = 0;
extern float soc_diff;
extern float capacity_diff;
extern uint8_t SoC_Save_Flag;

typedef enum {
	EVENT_FULL = 0,
	EVENT_EMPTY,
} modStateOfChargeVoltageEventTypeDef;

modStateOfChargeStructTypeDef* modStateOfChargeInit(modPowerElectronicsPackStateTypedef *packState, modConfigGeneralConfigStructTypedef *generalConfigPointer);
void modStateOfChargeProcess(void);
bool modStateOfChargeStoreAndLoadDefaultStateOfCharge(void);
bool modStateOfChargeStoreStateOfCharge(void);
bool modStateOfChargeLoadStateOfCharge(void);
bool modStateOfChargePowerDownSave(void);
void modStateOfChargeVoltageEvent(modStateOfChargeVoltageEventTypeDef eventType);

#endif
