#pragma once

#include "..\munga\style.h"

//########################################################################
//########################### RPL4 Steam Lobby ###########################
//########################################################################
//
// The multiplayer front door (docs/RP412-FRONTEND-DESIGN.md section 3):
// an ISteamMatchmaking lobby stands in for the arcade's Site Management
// screen. Every member publishes its FakeIP + fake ports + persona +
// loadout as lobby member data; the owner is the console. Launching
// writes a "go" roster into lobby data - each pod registers every
// peer with the Steam transport and enters the race, the owner
// through the hosted-race path (it builds the egg and marshals), the
// members as network pods waiting for the owner's console connection.
//
// The lobby OBJECT outlives races - that is the point of the single
// binary. After a race everyone lands back in the room for the next
// launch.
//
// Compiled to stubs without RP412_STEAM.
//
enum RPL4LobbyOutcome
{
	LobbyRoomLeft = 0,		// player left the lobby - back to the menu
	LobbyRoomClosed,		// window went away - quit
	LobbyLaunchHost,		// owner launched: hosted-race path is primed
	LobbyLaunchMember		// owner launched: enter the race as a pod
};

// True when the Steam transport is up (lobby UI is offered).
Logical
	RPL4Lobby_Available();

// True while we sit in a lobby (races return to the room).
Logical
	RPL4Lobby_InRoom();

// Create a lobby / find-and-join one, then run the room screen.
int
	RPL4Lobby_Host(HINSTANCE instance, HWND main_window);
int
	RPL4Lobby_Join(HINSTANCE instance, HWND main_window);

// Re-enter the room of the lobby we are already in (post-race).
int
	RPL4Lobby_Room(HINSTANCE instance, HWND main_window);

// Post-race score sheet: the owner publishes its console's results
// into lobby data; members pull them into the local results intake so
// the same results screen shows everywhere. Both are no-ops when not
// in a lobby (or not the respective role).
void
	RPL4Lobby_PushRaceResults();
void
	RPL4Lobby_PullRaceResults();
