#pragma once
// higgs.h: public ABI for higgstts.cpp.
//
// Single-header public API. Pure C99, consumable from C and C++ alike.
// Bindings (Python ctypes, Rust bindgen, Go cgo) parse this file directly.
// Style follows whisper.h / llama.h / omnivoice.h: extern "C" linkage on
// every entry, POD structs only, const char * UTF-8 strings, hg_status
// enum returns.

#include <stdbool.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

// Symbol visibility. Three Windows cases: building the SHARED target
// (HIGGS_BUILD set, dllexport), consuming the SHARED target from
// outside (nothing set, dllimport), consuming the STATIC archive
// (HIGGS_STATIC set by the static target's INTERFACE definitions,
// empty so the linker resolves the symbol directly without dllimport).
// On GCC/Clang the default-visibility attribute is harmless on static
// builds and required on shared builds.
#if defined(_WIN32) || defined(__CYGWIN__)
#    if defined(HIGGS_STATIC)
#        define HG_API
#    elif defined(HIGGS_BUILD)
#        define HG_API __declspec(dllexport)
#    else
#        define HG_API __declspec(dllimport)
#    endif
#elif defined(__GNUC__) || defined(__clang__)
#    define HG_API __attribute__((visibility("default")))
#else
#    define HG_API
#endif

// Struct ABI version. Incremented every time a public POD struct grows a
// new field at the end. Callers fill `.abi_version = HG_ABI_VERSION`
// (or let hg_*_default_params set it). Entries that consume those
// structs reject inputs whose abi_version exceeds the build-time
// constant: this guards a binary built against vN from receiving a
// struct laid out for vN+1 by a freshly compiled binding. Adding fields
// stays backward compat because the new tail is zero init in older
// callers and the lib reads only what its abi_version permits.
//
// There is no separate semver triple. The runtime build identity is the
// git short hash + commit date string returned by hg_version(); for
// binding compat checks, HG_ABI_VERSION is the only number that
// matters.
#define HG_ABI_VERSION 1

// Status codes returned by every fallible entry.
typedef enum hg_status {
    HG_STATUS_OK    = 0,
    HG_STATUS_ERROR = 1,
} hg_status;

// Build identity: git short hash + commit date, static string.
HG_API const char * hg_version(void);

#ifdef __cplusplus
}
#endif
