#pragma once

#include <stdbool.h>

/**
 * Configures the combined menu/reset button GPIO
 * (CONFIG_FRAME_COMBO_BUTTON_GPIO, active-low with internal pull-up) and
 * arms it as a deep-sleep wakeup source, same as the other buttons. Call
 * once, early in app_main(), before the device might enter deep sleep.
 *
 * A no-op if CONFIG_FRAME_COMBO_BUTTON_GPIO is negative (button disabled).
 */
void combo_button_init(void);

/**
 * Checks the combined menu/reset button and acts on how long it was
 * held, evaluated once per wake:
 *   - Not pressed: returns false immediately.
 *   - Released before CONFIG_FRAME_COMBO_SOFT_RESET_HOLD_MS (a quick
 *     press): returns true -- caller should show the management menu.
 *   - Released between the soft-reset and factory-reset thresholds: a
 *     soft reset (esp_restart(), stored WiFi/server config kept) --
 *     never returns.
 *   - Held through CONFIG_FRAME_COMBO_FACTORY_RESET_HOLD_MS: a factory
 *     reset (frame_config_clear() + esp_restart(), fires immediately
 *     without waiting for release) -- never returns.
 */
bool combo_button_check(void);

/**
 * Returns whether the combined button is currently held, with no
 * debounce and no hold-duration interpretation -- a bare live level
 * check. Used only by the already-shipped escalating-menu polling in
 * frame_client.c (wait_for_button_press()) to detect a further press
 * while the menu is already showing; deliberately never reused for
 * reset detection, so holding the button too long while escalating the
 * menu can't be misread as a reset request.
 */
bool combo_button_is_pressed(void);
