#pragma once
/*
 * turn_client.h — POST /v1/voice/turn to the NPC gateway and retrieve a WAV response.
 *
 * Stage 2: greeting fetch (kind="greeting").
 * Stage 3 will add kind="listen" / "speak".
 */
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
 * turn_client_greeting — POST /v1/voice/turn with kind="greeting".
 *
 * Sends:  { "session_id": session_id, "number": number, "kind": "greeting" }
 * Bearer: CONFIG_PLIP_GATEWAY_TOKEN (skipped if empty)
 * URL:    CONFIG_PLIP_GATEWAY_URL/v1/voice/turn
 *
 * On success (HTTP 200, body > 44 bytes written to out_path):
 *   - Streams the binary WAV response into fopen(out_path, "wb").
 *   - Returns true.
 *
 * On failure (network error, non-200, short body):
 *   - Logs a warning and returns false.
 *   - Does not crash; caller may proceed silently.
 */
bool turn_client_greeting(const char *session_id,
                           const char *number,
                           const char *out_path);

#ifdef __cplusplus
}
#endif
