using UnityEngine;
using TMPro;
using UnityEngine.SceneManagement;

public class MenuController : MonoBehaviour
{
    [Header("UI References")]
    public TMP_InputField subjectIdInput;

    [Header("Scene Settings")]
    public string firstSceneName = "InstructionScene";

    public void OnStartButtonClicked()
    {
        string subjectId = subjectIdInput.text.Trim();

        // Fallback in case you forget to type an ID
        if (string.IsNullOrEmpty(subjectId))
        {
            subjectId = "Test_Subject_01";
            Debug.LogWarning("[MenuController] ID was empty. Using default ID.");
        }

        // 1. Create folders and connect to MQTT
        ExperimentManager.Instance.InitializeSession(subjectId);

        // 2. Load the next scene
        SceneManager.LoadScene(firstSceneName);
    }
}