#ifndef BARREL_CONTROLLER_HPP_
#define BARREL_CONTROLLER_HPP_

#include <Block/SpriteBlock/Barrel/Barrel.hpp>
#include <memory>
#include <Controller/InventoryController/InventoryController.hpp>
#include <Machine/MBarrel/MBarrel.hpp>

/**
 * @brief The 'barrel' controller.
 */
class BarrelController : public InventoryController
{
private:
    std::shared_ptr<MBarrel> barrel;
    std::string fluidName;
    int fluidAmount = 0;
    std::optional<BarrelTier> tier;

    Command<uint32_t, BarrelTier> initBarrelTier;
    Command<uint32_t, std::string, int> updateBarrelState;

    Widget* getCaption();

public:
    BarrelController(ControllerChannel &channel);

    void onConnect(std::shared_ptr<Machine> barrelMachine);

    virtual Widget* getRightPanel() override;
    virtual void update() override;
};

#endif