#ifndef BLUE_FORCE_H
#define BLUE_FORCE_H

#include <cstdint>
#include "config.h"

// Blue Force — Friendly RID Whitelist
//
// Maintains a list of known-friendly DroneID serial numbers.
// When a detection matches a whitelisted emitter, the alert is
// suppressed and the FLAG_BLUE_FORCE bit is set instead.
//
// Serial numbers are stored as 20-byte strings (ANSI/CTA-2063-A format).

#define BLUE_FORCE_SERIAL_LEN 20

// Initialize blue force tracker
void blue_force_init();

// Add a serial number to the whitelist. Returns true on success.
bool blue_force_add(const char* serial);

// Remove a serial number from the whitelist. Returns true if found and removed.
bool blue_force_remove(const char* serial);

// Check if a signature hash matches any whitelisted serial.
// The hash is compared against pre-computed hashes of whitelisted serials.
bool blue_force_check_hash(const uint8_t* signature_hash);

// Check if a serial number string is whitelisted.
bool blue_force_check_serial(const char* serial);

// Get current whitelist count
uint8_t blue_force_count();

// Clear entire whitelist
void blue_force_clear();

// Compute the 8-byte signature hash for a serial number
// (truncated SHA-256 or simple FNV-1a — we use FNV-1a for speed on ESP32)
void blue_force_compute_hash(const char* serial, uint8_t* hash_out);

#endif // BLUE_FORCE_H
