set(srcs
    "src/rest_main.c"
    "src/evse_settings_api.c"
    "src/ocpp_api.c"
    "src/auth_api.c"
    "src/network_api.c"
    "src/meters_settings_api.c"
    "src/loadbalancing_settings_api.c"
    "src/dashboard_api.c"
    "src/static_file_api.c"
)

idf_component_register(
    SRCS ${srcs}
    INCLUDE_DIRS "include"
    PRIV_INCLUDE_DIRS "src"
    PRIV_REQUIRES nvs_flash esp_http_server esp_netif vfs spiffs json evse meter_manager loadbalancer
)

# SPIFFS image (opcional)
set(WEB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/webfolder")
if(EXISTS "${WEB_SRC_DIR}")
    spiffs_create_partition_image(data "${WEB_SRC_DIR}" FLASH_IN_PROJECT)
endif()
