#ifndef MEMORY_CHIP_HPP_
#define MEMORY_CHIP_HPP_

#include <Item/StatefulItem/StatefulItem.hpp>
#include <MachineConfig/MachineConfig.hpp>
#include <Serialize/Serialize.hpp>
#include <Utilities/RGBABytes.hpp>

struct MemoryChipState
{
    MachineConfig config;
    RGBABytes color;

    inline bool operator==(const MemoryChipState &other) const
    {
        return false;
    }
};

DERIVE_STRUCT_SERIALIZER(MemoryChipState, self.config, self.color);

class MemoryChip final : public StatefulItem<MemoryChipState>
{
public:
    MemoryChip(std::string name);

    void save(ItemStack &stack, const MachineConfig &config, const RGBABytes &color);
    const MachineConfig& getConfig(ItemStack &stack);

    virtual void draw(GraphicsContext &context, int x, int y, const ItemStack &stack) override;
    virtual std::string getDisplayName(const ItemStack &stack) override;
    virtual void draw3D(GraphicsContext &context, WorldDisplay &worldDisplay, glm::vec3 pos, ItemStack &stack) override;
    virtual void drawFlat(GraphicsContext &context, WorldDisplay &worldDisplay, glm::mat4 matrix, ItemStack &stack) override;
    virtual void getExtraToolTipLines(const ItemStack &stack, ToolTip &tip) override;
};

#endif