#ifndef INUCLEAR_REACTOR_COMPONENT_HPP_
#define INUCLEAR_REACTOR_COMPONENT_HPP_

#include <ItemStack/ItemStack.hpp>
#include <iostream>
#include <Machine/MNuclearReactor/MNuclearReactor.hpp>

class NuclearReactorController;

/**
 * @brief Interface implemented by items which are nuclear reactor components.
 */
class INuclearReactorComponent
{
public:
    virtual ~INuclearReactorComponent() = default;

    /**
     * @brief Write a description of nuclear reactor component into `os`.
     * 
     * @param stack The item stack. Do not modify.
     * @param os The stream into which to write the description.
     */
    virtual void describeInNuclearReactor(ItemStack &stack, std::ostream &os) = 0;

    /**
     * @brief Called during a reactor update for every instance of this component.
     * 
     * @param stack The stack containing this component (can be updated).
     * @param reactor The reactor being updated.
     * @param pos The cell position.
     * @return true if this component caused a nuclear reaction.
     */
    virtual bool updateNuclearReactor(ItemStack &stack, MNuclearReactor &reactor, glm::ivec2 pos) = 0;

    /**
     * @brief Returns the heat conductivity of this component.
     */
    virtual float getHeatConductivity(ItemStack &stack) = 0;

    /**
     * @brief Called when this component is above the critical temperature.
     *
     * Does nothing by default.
     */
    virtual void onOverheating(ItemStack &stack, MNuclearReactor &reactor, glm::ivec2 pos);

    /**
     * @brief Get the highlight to use in the specified reactor slot.
     *
     * Returns transparent by default.
     */
    virtual glm::vec4 getNuclearReactorSlotHighlight(ItemStack &stack, NuclearReactorController &ctrl, glm::ivec2 pos);
};

#endif