#ifndef DECORATION_HPP_
#define DECORATION_HPP_

#include <Chunk/Chunk.hpp>
#include <GeneratorNode/GeneratorNode.hpp>
#include <TerrainGenerator/TerrainGenerator.hpp>
#include <Decoration/ISculptor.hpp>

class SurvivalWorldGenerator;

/**
 * @brief Abstract base class for decorations that can spawn on terrain.
 */
class Decoration
{
public:
    /**
     * @brief A decoration builder through which blocks can be placed.
     */
    class Builder : public ISculptor
    {
    private:
        SurvivalWorldGenerator &worldgen;
        Chunk &chunk;
    
    public:
        /**
         * @brief Construct a builder for the specified chunk.
         */
        Builder(SurvivalWorldGenerator &worldgen, Chunk &chunk);

        /**
         * @brief Place a block at the specified coordinates.
         */
        virtual void place(glm::ivec3 pos, std::string name, uint8_t meta = 0) override;
    };

    virtual ~Decoration() = default;

    /**
     * @brief Build this decoration, with its bottom starting at the specified coordinates.
     * 
     * @param builder The decoration builder.
     * @param node Generator node to be used for variety in this decoration.
     * @param pos Coordinates of the bottom.
     */
    virtual void build(ISculptor &sculptor, GeneratorNode node, glm::ivec3 pos) = 0;

    /**
     * @brief Get the expected average number of this decoration for a given cell.
     */
    virtual double getAverageDensity(const TerrainGenerator::Cell &cell, GeneratorNode node) = 0;
};

#endif