#ifndef IINVENTORY_HPP_
#define IINVENTORY_HPP_

#include <ItemStack/ItemStack.hpp>

/**
 * @brief An interface implemented by some objects which manage inventories.
 */
class IInventory
{
public:
    virtual ~IInventory() = default;

    /**
     * @brief Return the number of items in this inventory which can merge into `templStack`.
     */
    int countItems(ItemStack &templStack);

    /**
     * @brief Return the number of slots in this inventory.
     * 
     * @return The number of slots.
     */
    virtual int getNumSlots() = 0;

    /**
     * @brief Get the stack stored in the specified slot.
     * 
     * @param slot The slot.
     * @return The item stack contained within.
     */
    virtual ItemStack getStackInSlot(int slot) = 0;
    
    /**
     * @brief Set the stack stored in the specified slot.
     * 
     * @param slot The slot.
     * @param stack The item stack to be stored within.
     */
    virtual void setStackInSlot(int slot, ItemStack stack) = 0;

    /**
     * @brief Determine if we are allowed to store the item stack in the specified slot.
     * 
     * @param slot The slot.
     * @param stack The stack which may or may not be allowed within.
     */
    virtual bool isAllowedStackInSlot(int slot, ItemStack stack) = 0;

    /**
     * @brief Insert a stack into this inventory.
     * 
     * @param stack The stack we try to insert; will be updated to whatever is left.
     */
    void insertStack(ItemStack &stack);

    /**
     * @brief Returns true if there is space to insert the specified stack into this inventory.
     */
    bool canInsertStack(ItemStack &stack);
};

#endif