#pragma once
#include <Arduino.h>
#include <HTTPClient.h>

unsigned long cooldownSecondsRemaining(unsigned long timeout, unsigned long timer);
String byteArrayAsHexString(byte *buffer, byte bufferSize);
String uint32AsHexString(uint32_t input);
String cardLink(WiFiClient* wifi, HTTPClient* http, String apiUrl, String cardId);
String cardBalance(WiFiClient* wifi, HTTPClient* http, String apiUrl, String cardId);
String cardTransaction(WiFiClient* wifi, HTTPClient* http, String apiUrl, String cardId, String amount);
String splitString(String data, char separator, int index);

enum e_state {
	STATE_IDLE,
	STATE_TRANSACT_CARDSCAN,
	STATE_TRANSACT_VERIFY,
	STATE_LINK_CARDSCAN,
	STATE_LINK_VERIFY,
	STATE_BALANCE_CARDSCAN,
	STATE_BALANCE_VERIFY,
	STATE_RESULT_SUCCESS,
	STATE_RESULT_FAILURE,
	STATE_RESULT_DISPLAY,
};
