#ifndef MGRINDING_BOWL_HPP_
#define MGRINDING_BOWL_HPP_

#include <vector>

#include <Machine/Machine.hpp>
#include <ItemStack/ItemStack.hpp>
#include <Item/IInventory.hpp>

/**
 * @brief The grinding bowl machine.
 */
class MGrindingBowl : public Machine, public IInventory
{
private:
    std::vector<ItemStack> m_stacks;
    uint32_t progress;

    ItemStack& inputSlot();
    ItemStack& outputSlot();

public:
    static constexpr uint32_t completionProgress = 20;

    MGrindingBowl(LocalWorld &world, glm::ivec3 pos);

    /**
     * @brief Get the current progress.
     */
    uint32_t getProgress();

    /**
     * @brief Called when the player clicks 'grind'.
     */
    void grind();

    virtual void serializeState(std::vector<uint8_t> &outBytes) override;
    virtual void deserializeState(const uint8_t *data, size_t size) override;
    virtual int getNumSlots() override;
    virtual ItemStack getStackInSlot(int slot) override;
    virtual void setStackInSlot(int slot, ItemStack stack) override;
    virtual bool isAllowedStackInSlot(int slot, ItemStack stack) override;
};

#endif