#ifndef LY_PLUGINS_INTERNAL_H_
#define LY_PLUGINS_INTERNAL_H_
#include <stdint.h>
#include "plugins.h"
#include "plugins_exts.h"
#include "plugins_types.h"
#define LY_TYPE_UNKNOWN_STR "unknown"
#define LY_TYPE_BINARY_STR "binary"
#define LY_TYPE_UINT8_STR "8bit unsigned integer"
#define LY_TYPE_UINT16_STR "16bit unsigned integer"
#define LY_TYPE_UINT32_STR "32bit unsigned integer"
#define LY_TYPE_UINT64_STR "64bit unsigned integer"
#define LY_TYPE_STRING_STR "string"
#define LY_TYPE_BITS_STR "bits"
#define LY_TYPE_BOOL_STR "boolean"
#define LY_TYPE_DEC64_STR "decimal64"
#define LY_TYPE_EMPTY_STR "empty"
#define LY_TYPE_ENUM_STR "enumeration"
#define LY_TYPE_IDENT_STR "identityref"
#define LY_TYPE_INST_STR "instance-identifier"
#define LY_TYPE_LEAFREF_STR "leafref"
#define LY_TYPE_UNION_STR "union"
#define LY_TYPE_INT8_STR "8bit integer"
#define LY_TYPE_INT16_STR "16bit integer"
#define LY_TYPE_INT32_STR "32bit integer"
#define LY_TYPE_INT64_STR "64bit integer"
extern struct ly_set ly_plugins_types;
extern struct ly_set ly_plugins_extensions;
extern uint32_t ly_static_type_plugins_count;
extern uint32_t ly_static_ext_plugins_count;
#define LYSC_GET_TYPE_PLG(PLUGIN_REF) \
((PLUGIN_REF) ? \
(((uintptr_t)(PLUGIN_REF) <= (uintptr_t)ly_static_type_plugins_count) ? \
(struct lyplg_type *)&((struct lyplg_type_record *)ly_plugins_types.objs[(PLUGIN_REF) - 1])->plugin : \
(struct lyplg_type *)(PLUGIN_REF)) : NULL)
#define LYSC_GET_EXT_PLG(PLUGIN_REF) \
((PLUGIN_REF) ? \
(((uintptr_t)(PLUGIN_REF) <= (uintptr_t)ly_static_ext_plugins_count) ? \
(struct lyplg_ext *)&((struct lyplg_ext_record *)ly_plugins_extensions.objs[(PLUGIN_REF) - 1])->plugin : \
(struct lyplg_ext *)(PLUGIN_REF)) : NULL)
LY_ERR lyplg_init(ly_bool builtin_type_plugins_only, ly_bool static_plugins_only);
void lyplg_clean(void);
uintptr_t lyplg_type_plugin_find(const struct ly_ctx *ctx, const char *module, const char *revision, const char *name);
uintptr_t lyplg_ext_plugin_find(const struct ly_ctx *ctx, const char *module, const char *revision, const char *name);
#endif