#include <GraphicsContext/GraphicsContext.hpp>
#include <Material/Material.hpp>
#include <Milestone/BrickByBrickMilestone/BrickByBrickMilestone.hpp>
#include <Milestone/BronzeAgeMilestone/BronzeAgeMilestone.hpp>
#include <Milestone/CarpentryMilestone/CarpentryMilestone.hpp>
#include <Color/Color.hpp>
#include <Milestone/MetalWorkingMilestone/MetalWorkingMilestone.hpp>
#include <BlockRegistry/BlockRegistry.hpp>

const std::string BrickByBrickMilestone::ID = "main:BrickByBrick";

BrickByBrickMilestone::BrickByBrickMilestone() :
    Milestone(
        blockRegistry.getBlockByName("main:clay").iconMaterial,
        blockRegistry.getBlockByName("main:clay").iconMaterial,
        "Brick by Brick"
    )
{
    addAchievement(
        CollectClay,
        blockRegistry.getBlockByName("main:clay").iconMaterial,
        blockRegistry.getBlockByName("main:clay").iconMaterial,
        "Collect clay",
        "*Find {block|main:clay} on the floor (pink, spawns occassionally).\n"
        "*Click and hold it to dig it.\n"
        "*Approach the {block|main:clay} to collect it.\n"
    );

    addAchievement(
        MakeBrickItem,
        Material::brick,
        Material::brick,
        "Construct a brick",
        "*Collect some {block|main:clay|1}.\n"
        "*Open your inventory.\n"
        "*Find the {item|main:brick} in the {menu|Construction} panel.\n"
        "*Click on {action|>>} to make it.\n"
        "@manualConstruct|main:brick|4|main:clay|1\n",
        Dependency{ID, CollectClay}
    );

    addAchievement(
        MakeGrindingBowl,
        blockRegistry.getBlockByName("main:grindingBowl").iconMaterial,
        blockRegistry.getBlockByName("main:grindingBowl").iconMaterial,
        "Make a grinding bowl",
        "*{action|Construct} a {block|main:grindingBowl}.\n"
        "@constructTable|main:grindingBowl|1|main:clay|8|main:ironIngot|3\n"
        "*Place and open the {machine|main:grindingBowl}.\n",
        Dependency{MetalWorkingMilestone::ID, MetalWorkingMilestone::MineIron},
        Dependency{ID, CollectClay}
    );

    addAchievement(
        MakeGreenDye,
        Material::greenDye,
        Material::greenDye,
        "Make green dye",
        "*Collect some {block|main:cactusLog}.\n"
        "*Open the {machine|main:grindingBowl}.\n"
        "*Place the {block|main:grindingBowl} and right-click to open it.\n"
        "*Place the {block|main:cactusLog} into the {inputSlot}.\n"
        "*Keep clicking the {action|Grind} button until the cactus is processed.\n"
        "@itemProc|main:grindingBowl|main:cactusLog|1|main:greenDye|1\n"
        "*Take the {item|main:greenDye} out of the bowl.\n",
        Dependency{ID, MakeGrindingBowl},
        Dependency{CarpentryMilestone::ID, CarpentryMilestone::Cactus}
    );

    addAchievement(
        MakeRubberTreeSap,
        blockRegistry.getBlockByName("main:rubberLog").iconMaterial,
        Material::rubberTreeSap,
        "Extract rubber tree sap",
        "*Collect some {block|main:rubberLog}.\n"
        "*Open the {machine|main:grindingBowl}.\n"
        "*Place the {block|main:grindingBowl} and right-click to open it.\n"
        "*Place the {block|main:rubberLog} into the {inputSlot}.\n"
        "*Keep clicking the {action|Grind} button until the log is processed.\n"
        "@itemProc|main:grindingBowl|main:rubberLog|1|main:rubberTreeSap|1\n"
        "*Take the {item|main:rubberTreeSap} out of the bowl.\n",
        Dependency{ID, MakeGrindingBowl},
        Dependency{CarpentryMilestone::ID, CarpentryMilestone::CollectWood}
    );

    addAchievement(
        MakeRubber,
        Material::rubberTreeSap,
        Material::rubber,
        "Make rubber",
        "*Open the {machine|main:stonePot}.\n"
        "*Place the {item|main:rubberTreeSap} into the {inputSlot}.\n"
        "*Place a fuel (e.g. {item|main:stick}, {block|main:planks})"
        " into the {fuelSlot}.\n"
        "*Wait until the rubber tree sap is smelted.\n"
        "@itemProc|main:stonePot|main:rubberTreeSap|1|main:rubber|1\n"
        "*Take the {item|main:rubber} out of the pot.\n",
        Dependency{BronzeAgeMilestone::ID, BronzeAgeMilestone::StonePot},
        Dependency{ID, MakeRubberTreeSap}
    );

    addAchievement(
        CollectSand,
        blockRegistry.getBlockByName("main:sand").iconMaterial,
        blockRegistry.getBlockByName("main:sand").iconMaterial,
        "Collect sand",
        "*Find {block|main:sand} on the floor (in deserts or beaches).\n"
        "*Click and hold it to dig it.\n"
        "*Approach the {block|main:sand} to collect it.\n"
    );

    addAchievement(
        MakeGlass,
        blockRegistry.getBlockByName("main:glass").iconMaterial,
        blockRegistry.getBlockByName("main:glass").iconMaterial,
        "Make glass",
        "*Open the {machine|main:stonePot}.\n"
        "*Place the {block|main:sand} into the {inputSlot}.\n"
        "*Place a fuel (e.g. {item|main:stick}, {block|main:planks})"
        " into the {fuelSlot}.\n"
        "*Wait until the sand is smelted.\n"
        "@itemProc|main:stonePot|main:sand|1|main:glass|1\n"
        "*Take the {block|main:glass} out of the pot.\n",
        Dependency{BronzeAgeMilestone::ID, BronzeAgeMilestone::StonePot},
        Dependency{ID, CollectSand}
    );
}