#pragma once

#include <Core/Common/String.h>

namespace Juliet
{
    // Fwd Declare
    struct DynamicLibrary;

    struct HotReloadCode
    {
        Arena* Arena;

        String DLLFullPath;
        String LockFullPath;
        String TransientDLLName;

        uint64 LastWriteTime;

        DynamicLibrary* Dll;

        void**       Functions;
        const char** FunctionNames;
        uint32       FunctionCount;

        uint32 UniqueID;

        bool IsValid : 1;
    };

    extern JULIET_API void InitHotReloadCode(HotReloadCode& code, String dllName, String transientDllName, String lockFilename);
    extern JULIET_API void ShutdownHotReloadCode(HotReloadCode& code);

    extern JULIET_API void LoadCode(HotReloadCode& code);
    extern JULIET_API void UnloadCode(HotReloadCode& code);

    extern JULIET_API void ReloadCode(HotReloadCode& code);
    extern JULIET_API bool ShouldReloadCode(const HotReloadCode& code);
} // namespace Juliet
