#ifndef PILLAR_HPP_
#define PILLAR_HPP_

#include <Block/SpriteBlock/SpriteBlock.hpp>

class Pillar : public SpriteBlock
{
private:
    /*
        #               Pillar Meta Byte
        +-------+---+---+---+---+---+---+---+---+
        | Bit   | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
        +-------+---+---+---+---+---+---+---+---+
        | Field |   |   |   |   |   |   | t | b |
        +-------+---+---+---+---+---+---+---+---+

        t
            If set, then there is a pillar block above us.
        
        b
            If set, then there is a pillar block below us.
    */
    static constexpr uint8_t metaPillarBottom = 1 << 0;
    static constexpr uint8_t metaPillarTop = 1 << 1;
    static constexpr uint8_t metaNumStates = 1 << 2;

    std::string variantName;

    static std::vector<Sprite> makeSprites(std::string variantName);

    void updateState(LocalWorld &world, glm::ivec3 pos);

public:
    Pillar(std::string name, std::string displayName, float hardness, std::string variantName);

    virtual void onNeighborUpdated(LocalWorld &world, glm::ivec3 pos, Side side) override;
    virtual void onPlaced(LocalWorld &world, Chunk &chunk, glm::ivec3 pos) override;
    virtual void onDesignerInitializing(BlockSpriteDesigner &designer, ScriptEngine &engine) override;
};

#endif