#ifndef RT_PROCESSOR_H
#define RT_PROCESSOR_H

#include "runtime/file_tab.h"
#include "runtime/mem_arena.h"
#include "runtime/resources.h"

#ifdef __cplusplus
extern "C" {
#endif

enum {
    RT_ASSET_PROCESSING_FAILED = RT_CUSTOM_ERROR_START,
};

#define RT_MAX_RESOURCES_PER_ASSET 32

/* Asset processor prototype.
 *
 * The new resources will replace the associated resources completely.
 */
#define RT_ASSET_PROCESSOR_FN(_Name)                                                               \
    rt_result _Name(rt_file_id file,                                                               \
                    unsigned int existing_resource_count,                                          \
                    const rt_resource_id *existing_resources,                                      \
                    unsigned int *new_resource_count,                                              \
                    rt_resource_id *new_resources,                                                 \
                    rt_arena *arena)
/* A Asset processor function */
typedef RT_ASSET_PROCESSOR_FN(rt_asset_processor_fn);

/* Allocated from the buffer manager */
typedef struct {
    void *buffer;
    size_t size;
} rt_loaded_asset;

rt_loaded_asset LoadAsset(rt_file_id file);

#ifdef __cplusplus
}
#endif

#endif