using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class InventoryManager : BaseWarehouseController
{
    public static int MAX_ITEMS = 5;

    public static InventoryManager Instance;

    // temporary delegate dragged item to outside static object instance to remember it
    [Space]
    [SerializeField] 
    protected ISlot _draggedSlot;
    public ISlot DraggedSlot
    {
        get { return _draggedSlot; }
        set
        {
            _draggedSlot = value;
        }
    }

    private void Awake()
    {
        if(Instance == null)
        {
            Instance = this;
        }else if (Instance != this)
        {
            Destroy(gameObject);
        }
    }

    public void AddToInventory(EquippableItem pickable)
    {
        if(this._items.Count <= MAX_ITEMS)
        {
            this._items[this._items.Count] = pickable;
        }else {
            Debug.Log("Cent add - Inventory is full");
        }
    }


    protected override void SetupPanel()
    {
        if(this.dynamicPanel)
        {
            this.dynamicPanel.GetComponent<InventoryPanelController>().Setup(gameObject, _items);
        }
    }


    // public void DropItem()
    // {

    // }    
}