using UnityEngine;

namespace Quest_Environment.Q3
{
    public class PickupRagAction : MonoBehaviour, IInteractable
    {
        [Header("Settings")]
        public ItemData ragItemData;

        public void Interact()
        {
            if (!(QuestManager.Instance?.currentQuest is Q3_WipeSurfacesQuest))
            {
                Debug.Log("I have no reason to pick this up right now.");
                return;
            }

            bool added = InventorySystem.Instance.AddItem(ragItemData);

            if (added)
            {
                if (InteractionHandler.Instance != null)
                {
                    InteractionHandler.Instance.NotifyInteraction(gameObject);
                }
                Destroy(gameObject);
            }
        }

        public string GetDescription()
        {
            if (QuestManager.Instance?.currentQuest is Q3_WipeSurfacesQuest)
            {
                return "Take the rag";
            }
            return "";
        }
    }
}