using UnityEngine;
using UnityEngine.SceneManagement;

/// <summary>
/// UI Button handler for scene transitions.
/// Attach to the Canvas or a manager object in your Win scene.
/// Then assign methods to button OnClick events.
/// </summary>
public class WinSceneController : MonoBehaviour
{
    [Header("Scene Settings")]
    [Tooltip("Name of the main game scene to load when restarting")]
    public string gameSceneName = "SampleScene";

    /// <summary>
    /// Restart the game - assign to button OnClick
    /// </summary>
    public void RestartGame()
    {
        Debug.Log("Restarting game...");
        SceneManager.LoadScene(gameSceneName);
    }

    /// <summary>
    /// Reload current scene
    /// </summary>
    public void ReloadCurrentScene()
    {
        Scene currentScene = SceneManager.GetActiveScene();
        SceneManager.LoadScene(currentScene.name);
    }

    /// <summary>
    /// Quit the game - assign to quit button OnClick
    /// </summary>
    public void QuitGame()
    {
        Debug.Log("Quitting game...");
        
        #if UNITY_EDITOR
        UnityEditor.EditorApplication.isPlaying = false;
        #else
        Application.Quit();
        #endif
    }

    /// <summary>
    /// Load a specific scene by name
    /// </summary>
    public void LoadScene(string sceneName)
    {
        SceneManager.LoadScene(sceneName);
    }
}
