#pragma once

#include <Core/HAL/OS/OS.h>

extern int JulietMain(int, wchar_t**);

#if JULIET_WIN32
#ifndef WINAPI
#define WINAPI __stdcall
#endif

#if UNICODE
int wmain(int argc, wchar_t** argv)
{
    return Juliet::Bootstrap(JulietMain, argc, argv);
}
#else
int main(int argc, char** argv)
{
    return Juliet::Bootstrap(JulietMain, argc, argv);
}
#endif

extern "C" {

typedef struct HINSTANCE__* HINSTANCE;
typedef char*               LPSTR;
typedef wchar_t*            PWSTR;

#if UNICODE
int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrev, PWSTR szCmdLine, int sw)
#else
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
#endif
{
    (void)hInst;
    (void)hPrev;
    (void)szCmdLine;
    (void)sw;

    return Juliet::Bootstrap(JulietMain, __argc, __wargv);
}
}
#else
#error "Only windows main is implemented"
#endif
