#ifndef VACUUM_UI_H
#define VACUUM_UI_H
#include <stdint.h>
#include <stdbool.h>
typedef struct {
 bool previous_power,previous_plus,previous_minus,hold_active,hold_consumed,run_requested;
 uint32_t both_since,last_ms;
 bool have_sample;
 uint8_t level;
} vui_state;
typedef struct {
 bool power_pressed,plus_pressed,minus_pressed;
 bool fault,learning_busy,learning_resources_ready;
} vui_input;
typedef struct { uint8_t level;bool run_requested,learning_request; } vui_output;
/* Key states must already be debounced. Poll at <=100ms intervals;
   the first snapshot primes levels without interpreting held keys as presses. Default level 1 is provisional.
   Module only requests actions; no fan duty, display percentage or learning
   success is fabricated. Caller must enforce validated motor limits. */
void vui_init(vui_state *s);
vui_output vui_step(vui_state *s,const vui_input *in,uint32_t now_ms);
/* Translate level ONLY using a separately qualified four-value fan table. */
bool vui_lookup_duty(uint8_t level,const uint16_t table[4],bool profile_valid,uint16_t *duty);
#endif
