using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System; 

public class ChestPanelController :  BasePanelController
{
    public override void CloseOnClick()
    {
        Destroy(gameObject);  // destroy panel

        if(_instance)
        {
            _instance.GetComponent<ChestController>().ClosePanel();
        }
    }

    public void Setup(GameObject _chest, Dictionary<int, Item> _chestItems)
    {
        _instance = _chest;

        base.Setup(_chestItems);
    }

    protected override ISlot SetupSlot(int key, GameObject _parent)
    {
        ChestSlot _tmpSlot = Instantiate(_blankSlot, _parent.transform.position, Quaternion.identity).GetComponent<ChestSlot>();

        _tmpSlot.transform.SetParent(_parent.transform);

        _tmpSlot.SetupSlot(key, null, this);

        return _tmpSlot;
    }

   
// Islot - > Aslot
//       - > B slots

// Ipanel -> Apanel
//        -> B panel


    // ---------------------------
    // will work differently depending if its chest, inventory or equipment panel 
    // public void Equip(EquippableItem item)
    // {
    //     if(RemoveItem(item))
    //     {
    //         EquippableItem previousItem;
    //     }
    // }
}