#ifndef _LUMA_STIKS_H
#define _LUMA_STIKS_H

#include <Arduino.h>
#include <esp_now.h>

#define LUMA_MAX_PEERS 10

typedef uint8_t PEER_ADDR[6];

typedef struct {
	bool enabled;
	String ssid;
	esp_now_peer_info_t peer;
}LUMA_NODE;

enum LUMA_PACKET_TYPE { LPT_RAW, LPT_REG, LPT_ANIM};

typedef struct{
	uint8_t data[64];
}LUMA_RAW_PACKET;

typedef struct{
	char ssid[24];
	uint8_t mac[6];
	uint8_t ch;
}LUMA_REGISTER_PACKET;

typedef struct{
	LUMA_PACKET_TYPE type;
	uint8_t data[64];
}LUMA_PACKET;


LUMA_NODE* Luma_ScanAPMaching(String startName, float minRssi, int &count);

bool Luma_Find_Node(const char* master_ssid, esp_now_peer_info_t &node);

int Luma_ConvertMACStringToMACAddress(const char* mChar, uint8_t* macAddr);

esp_err_t Luma_Node_Check(PEER_ADDR &addr);

esp_err_t Luma_Send_Packet(PEER_ADDR &peerAddr, LUMA_PACKET &packet);

void Luma_SendToAll_Packet(LUMA_PACKET &packet);


//void Luma_Send_Node_Array(LUMA_NODE *node[], int count, LUMA_PACKET &packet);

// TODO default RSSI
LUMA_NODE* Luma_Scan_For_Stations(String nameFilter, float minRssi, int &countFound);

esp_err_t Luma_Register_with_Master( esp_now_peer_info_t &masterNode, const char* nodeName);

String Luma_MacToStr(uint8_t* mac);

bool Luma_Add_Peer(esp_now_peer_info_t &node);

int Luma_PeerCount();



#endif