#include <BlockRegistry/BlockRegistry.hpp>
#include <Controller/InventoryController/CrateController/CrateController.hpp>
#include <Widget/Label/Label.hpp>
#include <Widget/Layout/CompoundWidget/IconText/IconText.hpp>
#include <Widget/StaticItemSlot/ItemSlot/ItemSlot.hpp>
#include <Widget/Layout/Row/Row.hpp>
#include <Widget/Layout/Column/Column.hpp>
#include <Widget/Layout/Center/Center.hpp>

CrateController::CrateController(ControllerChannel &channel) : InventoryController(channel) {}

void CrateController::onConnect(std::shared_ptr<Machine> crateMachine)
{
    bindMachine(crateMachine);
}

Widget* CrateController::getRightPanel()
{
    return new Column(
        new Center(new IconText(blockRegistry.getBlockByName("main:crate").iconMaterial, "Crate")),

        Layout::WithProportion<1>(),
        new Row(
            makeItemSlotColumn("machine", 0),
            makeItemSlotColumn("machine", 10),
            makeItemSlotColumn("machine", 20),
            makeItemSlotColumn("machine", 30),
            makeItemSlotColumn("machine", 40),
            makeItemSlotColumn("machine", 50)
        )
    );
}