#ifndef NUCLEAR_REACTOR_CONTROLLER_HPP_
#define NUCLEAR_REACTOR_CONTROLLER_HPP_

#include <Controller/InventoryController/InventoryController.hpp>
#include <Machine/MNuclearReactor/MNuclearReactor.hpp>
#include <RemoteDataComponent/RemoteDataComponent.hpp>

/**
 * @brief The nuclear reactor controller.
 */
class NuclearReactorController : public InventoryController
{
private:
    std::shared_ptr<MNuclearReactor> reactor;
    bool isSwitchedOn = false;
    int energy = 0;
    std::vector<DataCableComponent::InputRule> inputRules;

    Command<uint32_t, bool, int, std::vector<int>, std::vector<DataCableComponent::InputRule>> updateReactorState;
    Command<uint32_t, bool> setSwitch;

    RemoteDataComponent remoteDataComponent;

    Widget* makeReactorChamber();

public:
    std::vector<int> slotTemperatures = std::vector(8*8, 300);

    NuclearReactorController(ControllerChannel &channel);

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

    int getCellTemperature(glm::ivec2 pos);

    virtual Widget* getRightPanel() override;
    virtual glm::vec4 getSlotHighlight(const std::string &id, int slot, ItemStack &stack) override;
    virtual void getExtraToolTipLines(const std::string &id, int slot, ItemStack &stack, ToolTip &tip) override;
    virtual void update() override;
};

#endif