#ifndef GADGET_CONTROLLER_HPP_
#define GADGET_CONTROLLER_HPP_

#include <Controller/Controller.hpp>
#include <ControllerChannel/ControllerChannel.hpp>

/**
 * @brief Base class for controllers associated with gadgets (equipped items with overlays).
 */
class GadgetController : public Controller
{
private:
    std::optional<uint32_t> equipmentSlotIndex;

protected:
    const ItemStack& getBoundStack();

public:
    GadgetController(ControllerChannel &channel);

    /**
     * @brief Bind an equipment slot index to this controller.
     */
    void bindEquipmentSlot(uint32_t slot);

    /**
     * @brief Called after binding the equipment slot, on a local world.
     * 
     * By default does nothing.
     * 
     * @param stack The item stack in the equipment slot.
     */
    virtual void initLocal(const ItemStack &stack);

    virtual bool isBusy() override;
};

#endif