/* Reference fragment, not CI-built here. Add inside an nRF Connect SDK app.
 * ficus_card is an EXAMPLE stem. Use the actual package runtime_name/header.
 * Inputs: finite float32 processed features in the matching manifest order.
 * The standalone package returns a class only; no path-ID API is exported.
 * See Deploy for project-specific feature names and the actual class table.
 */
#include <stdint.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#include "ficus_card_legal_runtime.h"

/* Only enable after implementing a reviewed adapter whose path mapping is
 * bound to the exact card graph and validated against the predictor.
 * Replace the declaration with that adapter's actual API, not a guessed one.
 */
#if defined(FICUS_HAVE_REVIEWED_PATH_ADAPTER)
extern uint32_t app_reviewed_path_id(const float *features);
#endif

void app_publish_decision(const float *features)
{
    /* Caller checks manifest width, finiteness and preprocessing before entry. */
    const uint16_t class_id = ficus_card_legal_predict(features);
#if defined(FICUS_HAVE_REVIEWED_PATH_ADAPTER)
    const uint32_t path_id = app_reviewed_path_id(features);
    /* Exact Field monitor row: t_ms,class_id,path_id. Send after timing. */
    printk("%lld,%u,%u\n", (long long)k_uptime_get(),
           (unsigned)class_id, (unsigned)path_id);
#else
    /* A class-only debug line is NOT a valid Field monitor path record. */
    printk("class=%u path=unavailable\n", (unsigned)class_id);
#endif
}
