using RetroDev.Random;
using TMPro;
using UnityEngine;

public class WaveQuotes : MonoBehaviour
{
    // Reference to the TextMeshProUGUI component for displaying quotes
    public TextMeshProUGUI quoteText;

    // Singleton instance of WaveQuotes
    public static WaveQuotes instance;

    private void Awake()
    {
        instance = this; // Assign singleton instance
    }

    /// <summary>
    /// Displays a random quote for a wave.
    /// </summary>
    public void ShowQuote()
    {
        // Set a random quote
        quoteText.text = GenerateQuote();

        // Disable the quote after a delay
        Invoke(nameof(HideQuote), 3f);
    }

    /// <summary>
    /// Hides the displayed quote.
    /// </summary>
    public void HideQuote()
    {
        quoteText.text = string.Empty; // Clear the quote text
    }

    /// <summary>
    /// Generates and returns a random quote string.
    /// </summary>
    /// <returns>A randomly selected quote.</returns>
    public string GenerateQuote()
    {
        int randomInt = RandomUtil.RandomNumber(1, 10); // Generate a random number between 1 and 9

        // Select a quote based on the random number
        switch (randomInt)
        {
            case 1:
                return "Buckle up, space cowboys!";
            case 2:
                return "Get ready to clench those cheeks!";
            case 3:
                return "Incoming wave, hot and spicy!";
            case 4:
                return "Get ready to be probed by fun!";
            case 5:
                return "Because what can go wrong?";
            case 6:
                return "Is this thing working?";
            case 7:
                return "Wait, this isn't Asteroid?!";
            case 8:
                return "I was promised space tacos";
            case 9:
                return "We're running out of quotes, captain!";
            default:
                return "Wait, this isn't Asteroid?!";
        }
    }
}
