#include <BlockRegistry/BlockRegistry.hpp>
#include <ItemStack/ItemStack.hpp>
#include <Widget/BatteryView/BatteryView.hpp>
#include <Widget/DownArrow/DownArrow.hpp>
#include <Widget/FlameStatusIndicator/FlameStatusIndicator.hpp>
#include <Widget/FluidLevelIndicator/FluidLevelIndicator.hpp>
#include <Widget/ItemIcon/ItemIcon.hpp>
#include <Widget/Label/Label.hpp>
#include <Widget/Layout/Center/Center.hpp>
#include <Widget/Layout/Column/Column.hpp>
#include <Widget/Layout/CompoundWidget/Deck/Deck.hpp>
#include <Widget/Layout/CompoundWidget/DocPotDiagram/DocPotDiagram.hpp>
#include <Widget/Layout/CompoundWidget/Form/Form.hpp>
#include <Widget/Layout/CompoundWidget/IconText/IconText.hpp>
#include <Widget/Layout/Frame/Frame.hpp>
#include <Widget/Layout/PotView/PotView.hpp>
#include <Widget/Layout/Row/Row.hpp>
#include <Widget/Panel/Panel.hpp>
#include <Widget/ProgressIndicator/ProgressIndicator.hpp>
#include <Widget/StaticItemSlot/StaticItemSlot.hpp>
#include <Machine/MPot/MPot.hpp>

DocPotDiagram::DocPotDiagram(const std::vector<std::string> &args)
{
    static std::string waterName = "main:water";

    static uint32_t temperature = 0;
    static uint32_t progress = 1200;
    static uint32_t fuelCurrent = 130;
    static uint32_t fuelBatch = 150;
    static uint32_t maxProgress = MPot::getCompletedProgress(false);

    addChildren(
        new Frame(
            new Form(
                new IconText(Material::stonePotIconTodo, "Stone Pot"),
                new Column(
                    new Panel(glm::ivec2(100, 0)),
                    new Center(
                        new Column(
                            new PotView(
                                temperature,
                                new Row(
                                    (new StaticItemSlot(
                                        []() { return blockRegistry.getBlockByName("main:stoneTinOre").toItemStack(16); }
                                    ))
                                        ->withStaticHighlight(Color::inputHighlight),
                                    new Center(
                                        new ProgressIndicator(
                                            progress,
                                            maxProgress
                                        )
                                    ),
                                    (new StaticItemSlot(
                                        []() { return ItemStack("main:tinIngot", 8); }
                                    ))
                                        ->withStaticHighlight(Color::faded)
                                )
                            ),
                
                            new Row(
                                new Panel(glm::ivec2(6, 1)),
                                new FlameStatusIndicator<uint32_t>(
                                    fuelCurrent,
                                    fuelBatch
                                )
                            ),
                
                            new Row(
                                (new StaticItemSlot(
                                    []() { return blockRegistry.getBlockByName("main:planks").toItemStack(7); }
                                ))
                                    ->withStaticHighlight(Color::fuelHighlight)
                            )
                        )
                    )
                )
            )
        )
    );
}