#include "pch.h"

#include "platform_windows/windows_main_window_session.h"

namespace pp::platform::windows {
namespace {

struct RetainedMainWindowSessionState final {
    HWND handle{};
    wchar_t title[512]{};
    bool sandboxed = false;
};

[[nodiscard]] RetainedMainWindowSessionState& retained_main_window_session_state() noexcept
{
    static RetainedMainWindowSessionState state;
    return state;
}

}

HWND& retained_main_window_handle_ref() noexcept
{
    return retained_main_window_session_state().handle;
}

wchar_t* retained_main_window_title_buffer() noexcept
{
    return retained_main_window_session_state().title;
}

const wchar_t* retained_main_window_title() noexcept
{
    return retained_main_window_session_state().title;
}

bool retained_main_window_sandboxed() noexcept
{
    return retained_main_window_session_state().sandboxed;
}

void set_retained_main_window_sandboxed(bool sandboxed) noexcept
{
    retained_main_window_session_state().sandboxed = sandboxed;
}

}
