#ifndef DISPLAY_MANAGER_H
#define DISPLAY_MANAGER_H
#include
#include "animation_manager.h"
#include "ui_themes.h" // Include new theme definitions
// (AP/Offline/WiFi)
enum class StartupMode {
AP_MODE, // Access Point
OFFLINE_MODE, // offline (WiFi )
WIFI_MODE // WiFi (default)
};
class DisplayManager {
public:
enum class HeaderState { INTRO, STATIC, CHARGING };
DisplayManager();
void initForSplash(); // Early init for splash screen (PWM + TFT only, no fill)
void init();
void update();
void updateHeader();
void drawLayout(const String& serviceName, int batteryPercentage, bool isCharging, bool isWebServerOn);
void drawPasswordLayout(const String& name, const String& password, int batteryPercentage, bool isCharging, bool isWebServerOn, uint8_t strength = 0, bool isDuplicate = false, bool isPin = false, bool isName = false, bool auto_send = false, bool send_login = false, const String& nav_mode = "enter", bool isWildcard = false);
void updateBatteryStatus(int percentage, bool isCharging);
void updateClockStatus();
void updateTOTPCode(const String& code, int timeRemaining, int period = 30);
void turnOff();
void turnOn();
void setBrightness(uint8_t brightness); // Set backlight brightness (0-255) for fade effects
bool promptWebServerSelection(); // New function for user prompt
StartupMode promptModeSelection(StartupMode defaultMode = StartupMode::WIFI_MODE); // (AP/Offline/WiFi)
void drawNoItemsPage(const String& text);
void drawBleInitLoader(int progress);
#ifdef BOARD_HAS_USB_HID
bool drawHidPrompt(bool defaultIsBle);
void drawUsbHidPage(const String& passwordName, const String& status,
const String& login, bool sendLogin);
void resetUsbHidPage();
void setUsbHidMode(bool active);
private:
String _usbHidLastStatus = "";
bool _usbHidMode = false;
public:
#endif
void drawGenericLoader(int progress, const String& text); //
void drawHOTPLoader(int progress); // HOTP loader progress 0-100
void hideLoader(); //
void resetLoaderState(); // Reset loader flags without clearing screen
void eraseLoaderArea(); // Erase loader bar area and reset flags
bool isLoaderActive() const { return _loaderActive; } //
void drawBleAdvertisingPage(const String& deviceName, const String& status, int timeLeft);
void drawBleConfirmPage(const String& passwordName, const String& password, const String& deviceName, const String& login, bool sendLogin);
void drawBleSendingPage(const String& passwordName, const String& login, bool sendLogin);
void drawBleResultPage(bool success);
// QR Code display
void showQRCode(const String& text, int timeoutSeconds = 30);
void hideQRCode();
bool isQRCodeActive() const { return _qrCodeActive; }
void requestShowQRCode(const String& text, int timeoutSeconds = 30); // Thread-safe request
void updateQRTimer(int secondsRemaining); // Update timer without full redraw
bool consumePasswordRedrawFlag() { bool f = _passwordScreenNeedsRedraw; _passwordScreenNeedsRedraw = false; return f; } // Test-and-clear, mirrors _totpContainerNeedsRedraw pattern
void setKeySwitched(bool switched) { _isKeySwitched = switched; } //