#ifndef FLUID_BLOCK_HPP_
#define FLUID_BLOCK_HPP_

#include <Block/Block.hpp>
#include <MovementPhysics/SwimPhysics/SwimPhysics.hpp>

/**
 * @brief A class representing a loose fluid block.
 */
class FluidBlock : public Block
{
private:
    SwimPhysics* swimPhysics;
    BlockAtlas::SpriteID levelSprites[8];

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

public:
    static constexpr uint32_t sigSink = 0;

    std::string fluidName;

    FluidBlock(std::string name, std::string fluidName);

    virtual void loadBlockSprites(BlockAtlas &atlas, Bitmap &icon, VoxelSprite &defaultSprite) override;
    virtual BlockAtlas::SpriteID getBlockSprite(glm::ivec3 pos, uint8_t meta, World &world) override;
    virtual bool isFullyOpaque() override;
    virtual bool concealsFluidBelow() override;
    virtual bool isIntersectedByRay(World &world, glm::ivec3 pos, wfvec3 start, wfvec3 dir, Side &side, RGBABytes &collisionKey) override;
    virtual bool isIntersectedBy(World &world, glm::ivec3 pos, const BoundingBox<wfixed> &box) override;
    virtual bool isFluid() override;
    virtual void onNeighborUpdated(LocalWorld &world, glm::ivec3 pos, Side side) override;
    virtual void onSignal(LocalWorld &world, glm::ivec3 pos, uint32_t code) override;
    virtual bool canReplaceWithPlacedBlock() override;
    virtual MovementPhysics& getMovementPhysicsInside() override;
    virtual void onEntering(World &world, PhysicsEntity &entity) override;
    virtual void onLeaving(World &world, PhysicsEntity &entity) override;
};

#endif