#ifndef FARM_PLANT_HPP_
#define FARM_PLANT_HPP_

#include <Block/SpriteBlock/SpriteBlock.hpp>

/**
 * @brief Base class for all plants growing on farmland.
 */
class FarmPlant : public SpriteBlock
{
private:
    static constexpr uint32_t sigGrow = 0;
    static constexpr int growthTimeVariation = 60 * 60 * 5;

protected:
    FarmPlant(std::string name, std::string displayName, const std::vector<std::string> &stateNames);

    /**
     * @brief Returns the growth stage duration for this plant.
     *
     * This function shall return the number of ticks 
     */
    virtual int getGrowthStageTicks(int nutrition) = 0;

    /**
     * @brief Returns the amount of water needed from farm land per growth stage.
     */
    virtual int getWaterUsage() = 0;

    /**
     * @brief Get the harvested stacks from a farm, given the nutrition level.
     */
    virtual void getFarmHarvest(int nutrition, std::vector<ItemStack> &stacks) = 0;

public:
    virtual bool canManuallyDig() override;
    virtual bool canPlace(LocalWorld &world, IWorldActor &actor, glm::ivec3 pos, Side side, uint8_t &meta) override;
    virtual bool isIntersectedBy(World &world, glm::ivec3 pos, const BoundingBox<wfixed> &box) override;
    virtual void onNeighborUpdated(LocalWorld &world, glm::ivec3 pos, Side side) override;
    virtual void onPlaced(LocalWorld &world, Chunk &chunk, glm::ivec3 pos) override;
    virtual void onSignal(LocalWorld &world, glm::ivec3 pos, uint32_t code) override;
    virtual void getHarvestedStacks(LocalWorld &world, glm::ivec3 pos, std::vector<ItemStack> &stacks) override;
    virtual bool canSweepAway() override;
};

#endif