#ifndef ELECTRIC_LAMP_HPP_
#define ELECTRIC_LAMP_HPP_

#include <Block/SpriteBlock/SpriteBlock.hpp>
#include <Block/MachineBlockMixin.hpp>
#include <Machine/MElectricLamp/MElectricLamp.hpp>

class ElectricLamp : public SpriteBlock, public MachineBlockMixin<MElectricLamp>
{
private:
    static std::vector<Sprite> makeSprites();

public:
    /*
        #            Template Meta Byte
        +-------+---+---+---+---+---+---+---+---+
        | Bit   | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
        +-------+---+---+---+---+---+---+---+---+
        | Field |   |   |   |   | O | B | G | R |
        +-------+---+---+---+---+---+---+---+---+

        R, G, B
            If set, the red, green or blue component of the light is active.
        
        O
            If set, the lamp is currently on.
    */

    static constexpr uint8_t metaRed = 1 << 0;
    static constexpr uint8_t metaGreen = 1 << 1;
    static constexpr uint8_t metaBlue = 1 << 2;
    static constexpr uint8_t metaOn = 1 << 3;

    ElectricLamp(std::string name);

    virtual bool canManuallyDig() override;
    virtual void onPlaced(LocalWorld &world, Chunk &chunk, glm::ivec3 pos) override;
    virtual glm::vec3 getLightColor(uint8_t meta) override;
    virtual void onInteract(LocalWorld &world, Player &player, glm::ivec3 pos, Side side, const RGBABytes &collisionKey) override;
};

#endif