#ifndef _CONFIGTPL_H
#define _CONFIGTPL_H
#pragma once
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#define CONFIGTPL_FEATURE_SHARED_LIB
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef enum configtpl_BuildStatus {
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_BUILD_STATUS_SUCCESS = 0,
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_BUILD_STATUS_ERROR_INVALID_HANDLE = 1,
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_BUILD_STATUS_ERROR_BUILDING = 200,
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_BUILD_STATUS_ERROR_UNKNOWN = 255,
#endif
} configtpl_BuildStatus;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef enum configtpl_ConfigParamType {
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_CONFIG_PARAM_TYPE_BOOLEAN,
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_CONFIG_PARAM_TYPE_MAP,
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_CONFIG_PARAM_TYPE_FLOAT,
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_CONFIG_PARAM_TYPE_INT,
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_CONFIG_PARAM_TYPE_NULL,
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_CONFIG_PARAM_TYPE_STRING,
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_CONFIG_PARAM_TYPE_VEC,
#endif
} configtpl_ConfigParamType;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef enum configtpl_SimpleResult {
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_SIMPLE_RESULT_SUCCESS = 0,
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
CONFIGTPL_SIMPLE_RESULT_ERROR = 1,
#endif
} configtpl_SimpleResult;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef unsigned int configtpl_UInt;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef configtpl_UInt configtpl_CfgBuilderHandle;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef unsigned short configtpl_Bool;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef double configtpl_LongFloat;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef const char *configtpl_ConstCharPtr;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef struct configtpl_ConfigParamDictItem {
configtpl_ConstCharPtr name;
const struct configtpl_ConfigParam *value;
} configtpl_ConfigParamDictItem;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef struct configtpl_Array_ConfigParamDictItem {
struct configtpl_ConfigParamDictItem *data;
configtpl_UInt len;
} configtpl_Array_ConfigParamDictItem;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef long configtpl_LongInt;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef struct configtpl_Array_ConfigParam {
struct configtpl_ConfigParam *data;
configtpl_UInt len;
} configtpl_Array_ConfigParam;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef union configtpl_ConfigParamValue {
configtpl_Bool boolean;
configtpl_LongFloat float_num;
struct configtpl_Array_ConfigParamDictItem map;
configtpl_LongInt integer;
configtpl_ConstCharPtr string;
struct configtpl_Array_ConfigParam vector;
} configtpl_ConfigParamValue;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef struct configtpl_ConfigParam {
enum configtpl_ConfigParamType param_type;
union configtpl_ConfigParamValue value;
} configtpl_ConfigParam;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef struct configtpl_BuildResult {
enum configtpl_BuildStatus status;
struct configtpl_ConfigParam output;
configtpl_ConstCharPtr error_msg;
} configtpl_BuildResult;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef struct configtpl_Array_ConstCharPtr {
configtpl_ConstCharPtr *data;
configtpl_UInt len;
} configtpl_Array_ConstCharPtr;
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
typedef struct configtpl_BuildArgs {
struct configtpl_ConfigParam *context;
struct configtpl_ConfigParam *defaults;
configtpl_ConstCharPtr env_vars_prefix;
struct configtpl_ConfigParam *overrides;
struct configtpl_Array_ConstCharPtr paths;
} configtpl_BuildArgs;
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
configtpl_CfgBuilderHandle configtpl_configbuilder_new(void);
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
const struct configtpl_BuildResult *configtpl_configbuilder_build(configtpl_CfgBuilderHandle env_handle,
struct configtpl_BuildArgs args);
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
void configtpl_configbuilder_result_free(const struct configtpl_BuildResult *r);
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
void configtpl_configbuilder_free(configtpl_CfgBuilderHandle env_handle);
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
enum configtpl_SimpleResult configtpl_init(void);
#endif
#if defined(CONFIGTPL_FEATURE_SHARED_LIB)
enum configtpl_SimpleResult configtpl_cleanup(void);
#endif
#ifdef __cplusplus
} #endif
#endif