using UnityEngine;
using UnityEngine.Events;


// base class for all rewards
public abstract class InventoryItem : ScriptableObject
{
    [SerializeField] public string itemName;
    [SerializeField] public int quantity = 1;


    public abstract void giveReward(GameObject player);

}

[CreateAssetMenu(menuName = "GameItems/ItemReward")]
public class ItemReward : InventoryItem
{
    public ItemReward(string itemName, int quantity)
    {
        this.itemName = itemName;
        this.quantity = quantity;
    }

    public override void giveReward(GameObject player)
    {
        ItemReward reward = ScriptableObject.CreateInstance<ItemReward>();
        reward.itemName = itemName;
        reward.quantity = quantity;
        player.GetComponent<PlayerInteraction>().AddToInventory(reward);
        // Add logic to give an item to the player
        Debug.Log($"You have received {quantity} {itemName}(s)!");
    }
}
