#ifndef BOARD_CONFIG_H_
#define BOARD_CONFIG_H_

#include "hal/adc_types.h"
#include "hal/gpio_types.h"
#include "soc/soc_caps.h"

typedef enum
{
    BOARD_CONFIG_ENERGY_METER_NONE,
    BOARD_CONFIG_ENERGY_METER_CUR,
    BOARD_CONFIG_ENERGY_METER_CUR_VLT
} board_config_energy_meter_t;

typedef enum
{
    BOARD_CONFIG_SERIAL_NONE,
    BOARD_CONFIG_SERIAL_UART,
    BOARD_CONFIG_SERIAL_RS485
} board_config_serial_t;

typedef struct
{
    char device_name[32];

    bool led_blue : 1;
    gpio_num_t led_blue_gpio;
    bool led_red : 1;
    gpio_num_t led_red_gpio;
    bool led_green : 1;
    gpio_num_t led_green_gpio;

    bool buzzer : 1;
    gpio_num_t buzzer_gpio;

    gpio_num_t button_wifi_gpio;

    gpio_num_t pilot_pwm_gpio;
    adc_channel_t pilot_adc_channel;
    uint16_t pilot_down_threshold_12;
    uint16_t pilot_down_threshold_9;
    uint16_t pilot_down_threshold_6;
    uint16_t pilot_down_threshold_3;
    uint16_t pilot_down_threshold_n12;

    bool proximity : 1;
    adc_channel_t proximity_adc_channel;
    uint16_t proximity_down_threshold_8;
    uint16_t proximity_down_threshold_10;
    uint16_t proximity_down_threshold_13;
    uint16_t proximity_down_threshold_20;
    uint16_t proximity_down_threshold_25;
    uint16_t proximity_down_threshold_32;

    gpio_num_t ac_relay_gpio;

    bool socket_lock : 1;
    gpio_num_t socket_lock_a_gpio;
    gpio_num_t socket_lock_b_gpio;
    gpio_num_t socket_lock_detection_gpio;
    uint16_t socket_lock_detection_delay;
    uint16_t socket_lock_min_break_time;

    bool rcm : 1;
    gpio_num_t rcm_gpio;
    gpio_num_t rcm_test_gpio;

} board_config_t;

extern board_config_t board_config;

void board_config_load();

#endif /* BOARD_CONFIG_H_ */
