#ifndef LAMP_UI_POLICY_H
#define LAMP_UI_POLICY_H

#include "lamp_program.h"

typedef enum {
    LUI_BUTTON_BASE_COLOR,
    LUI_BUTTON_DARK_GEL,
    LUI_BUTTON_BUILDER_EXTENSION,
    LUI_BUTTON_TOP_COAT,
    LUI_BUTTON_LONG_PRESS_MANUAL,
    LUI_BUTTON_MANUAL_60,
    LUI_BUTTON_MANUAL_120,
    LUI_BUTTON_CANCEL,
    LUI_BUTTON_INVALID
} lamp_ui_button;

typedef enum {
    LUI_COMMAND_NONE,
    LUI_COMMAND_SET_MODE,
    LUI_COMMAND_START_RECIPE,
    LUI_COMMAND_STOP
} lamp_ui_command_kind;

/* UI-to-controller intent. SET_MODE must stop an active run before the target
   acknowledges Manual; START_RECIPE must be checked by the safety guard;
   STOP must remain effective in fault state. These are commands, not
   acknowledgements. Display running/countdown only from target status. */
typedef struct {
    lamp_ui_command_kind kind;
    lg_mode mode;
    lp_recipe recipe;
    uint32_t duration_ms;
} lamp_ui_command;

/* Translate a debounced SoC/UI button event into a controller command.
   current_mode must be the latest acknowledged target mode. Failure leaves
   command untouched. This module has no GPIO, display, UART or LED HAL. */
bool lamp_ui_resolve_button(lg_mode current_mode, lamp_ui_button button,
                            lamp_ui_command *command);

#endif
