#include <FluidRegistry/FluidRegistry.hpp>
#include <Widget/EnumSelector/EnumSelector.hpp>
#include <Widget/Layout/CompoundWidget/FluidPicker/FluidPicker.hpp>
#include <optional>

FluidPicker::FluidPicker(std::optional<std::string> &value, std::function<void()> onChanged)
{
    options.push_back({std::nullopt, "(Any)"});

    fluidRegistry.forEachFluid([this](Fluid *fluid)
    {
        options.push_back({std::optional(fluid->name), fluid->displayName});
    });

    addChildren(
        new EnumSelector<std::optional<std::string>>(value, options, onChanged)
    );
}