using System;
using System.Collections.Generic;
using EFT;
using EFT.NextObservedPlayer;
using EFT.UI;
using stupid.solutions.stupid.solutions.Data;
using UnityEngine;

namespace stupid.solutions.Data;

public class WildSpawnTypeManager : MonoBehaviour
{
	private static List<(ObservedPlayerView PlayerInstance, WildSpawnType Role)> unassignedRoles = new List<(ObservedPlayerView, WildSpawnType)>();

	public void Start()
	{
		ConsoleScreen.Log("WST Manager initiated");
	}

	public static void WST_Postfix(ObservedPlayerView __instance, WildSpawnType role)
	{
		try
		{
			ConsoleScreen.Log("WST method_6 called for ObservedPlayerView.");
			unassignedRoles.Add((__instance, role));
			foreach (OnlineGamePlayer onlineGamePlayer in Main.OnlineGamePlayers)
			{
				if (__instance.ProfileId == onlineGamePlayer.profileid)
				{
					onlineGamePlayer.wst = role;
					onlineGamePlayer.gotwst = true;
				}
			}
			ConsoleScreen.Log($"Temporary role assignment queued: PlayerPID={__instance.ProfileId}, Role={role}");
		}
		catch (Exception)
		{
		}
	}
}
