#include <Block/SpriteBlock/FarmPlant/WheatPlant/WheatPlant.hpp>
#include <BlockRegistry/BlockRegistry.hpp>
#include <ItemStack/ItemStack.hpp>

int WheatPlant::getGrowthStageTicks(int nutrition)
{
    switch (nutrition)
    {
    case 1:                 return World::cycleDuration * 3;
    case 2:                 return World::cycleDuration * 2;
    case 3:                 return World::cycleDuration;
    default:                return 0;
    }
}

int WheatPlant::getWaterUsage()
{
    return 1;
}

void WheatPlant::getFarmHarvest(int nutrition, std::vector<ItemStack> &stacks)
{
    stacks.push_back(blockRegistry.getBlockByName("main:wheatSeeds").toItemStack(nutrition == 3 ? 2 : 1));
    stacks.push_back(ItemStack("main:wheat", 1 << nutrition));
}

WheatPlant::WheatPlant(std::string name) :
    FarmPlant(
        name,
        "Wheat seeds",
        {"stage0", "stage1", "stage2", "dead"}
    )
{}