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

const std::string MetalWorkingMilestone::ID = "main:MetalWorking";

MetalWorkingMilestone::MetalWorkingMilestone() :
    Milestone(
        Material::ironIngot,
        Material::ironIngot,
        "Metal Working"
    )
{
    addAchievement(
        MineIron,
        blockRegistry.getBlockByName("main:ironOre").iconMaterial,
        Material::ironIngot,
        "Mine iron",
        "*Select the {item|main:bronzePickaxe} in the sidebar.\n"
        "*Find {block|main:ironOre} underground and collect it.\n"
        "*{action|Smelt} the {block|main:ironOre} to get {item|main:ironIngot}.\n"
        "@itemProc|main:stonePot|main:ironOre|1|main:ironIngot|1\n"
        "*Take the {item|main:ironIngot} out of the pot.\n",
        Dependency{BronzeAgeMilestone::ID, BronzeAgeMilestone::BronzePickaxe}
    );

    addAchievement(
        MineNickel,
        blockRegistry.getBlockByName("main:nickelOre").iconMaterial,
        Material::nickelIngot,
        "Mine nickel",
        "*Select the {item|main:bronzePickaxe} in the sidebar.\n"
        "*Find {block|main:nickelOre} underground and collect it.\n"
        "*{action|Smelt} the {block|main:nickelOre} to get {item|main:nickelIngot}.\n"
        "@itemProc|main:stonePot|main:nickelOre|1|main:nickelIngot|1\n"
        "*Take the {item|main:nickelIngot} out of the pot.\n",
        Dependency{BronzeAgeMilestone::ID, BronzeAgeMilestone::BronzePickaxe}
    );

    addAchievement(
        MineSilver,
        blockRegistry.getBlockByName("main:silverOre").iconMaterial,
        Material::silverIngot,
        "Mine silver",
        "*Select the {item|main:bronzePickaxe} in the sidebar.\n"
        "*Find {block|main:silverOre} underground and collect it.\n"
        "*{action|Smelt} the {block|main:silverOre} to get {item|main:silverIngot}.\n"
        "@itemProc|main:stonePot|main:silverOre|1|main:silverIngot|1\n"
        "*Take the {item|main:silverIngot} out of the pot.\n",
        Dependency{BronzeAgeMilestone::ID, BronzeAgeMilestone::BronzePickaxe}
    );

    addAchievement(
        MineLead,
        blockRegistry.getBlockByName("main:leadOre").iconMaterial,
        Material::leadIngot,
        "Mine lead",
        "*Select the {item|main:bronzePickaxe} in the sidebar.\n"
        "*Find {block|main:leadOre} underground and collect it.\n"
        "*{action|Smelt} the {block|main:leadOre} to get {item|main:leadIngot}.\n"
        "@itemProc|main:stonePot|main:leadOre|1|main:leadIngot|1\n"
        "*Take the {item|main:leadIngot} out of the pot.\n",
        Dependency{BronzeAgeMilestone::ID, BronzeAgeMilestone::BronzePickaxe}
    );

    addAchievement(
        MineGold,
        blockRegistry.getBlockByName("main:goldOre").iconMaterial,
        Material::goldIngot,
        "Mine gold",
        "*Select the {item|main:bronzePickaxe} in the sidebar.\n"
        "*Find {block|main:goldOre} underground and collect it.\n"
        "*{action|Smelt} the {block|main:goldOre} to get {item|main:goldIngot}.\n"
        "@itemProc|main:stonePot|main:goldOre|1|main:goldIngot|1\n"
        "*Take the {item|main:goldIngot} out of the pot.\n",
        Dependency{BronzeAgeMilestone::ID, BronzeAgeMilestone::BronzePickaxe}
    );

    addAchievement(
        MineSilicon,
        blockRegistry.getBlockByName("main:siliconOre").iconMaterial,
        Material::siliconIngot,
        "Mine silicon",
        "*Select the {item|main:bronzePickaxe} in the sidebar.\n"
        "*Find {block|main:siliconOre} underground and collect it.\n"
        "*{action|Smelt} the {block|main:siliconOre} to get {item|main:siliconIngot}.\n"
        "@itemProc|main:stonePot|main:siliconOre|1|main:siliconIngot|1\n"
        "*Take the {item|main:siliconIngot} out of the pot.\n",
        Dependency{BronzeAgeMilestone::ID, BronzeAgeMilestone::BronzePickaxe}
    );

    addAchievement(
        IronPickaxe,
        Material::ironPickaxe,
        Material::ironPickaxe,
        "Construct the iron pickaxe",
        "*{action|Construct} the {item|main:ironPickaxe}.\n"
        "@constructTable|main:ironPickaxe|1|main:ironIngot|3|main:stick|8\n",
        Dependency{ID, MineIron}
    );

    addAchievement(
        IronPot,
        Material::ironPotIconTodo,
        Material::ironPotIconDone,
        "The iron pot",
        "*{action|Construct} the {block|main:ironPot}.\n"
        "@constructTable|main:ironPot|1|main:ironIngot|12|main:stick|16\n"
        "*Open the {machine|main:ironPot}.\n"
        "The iron pot:\n"
        "*Heats up faster.\n"
        "*Smelts each item twice as fast.\n"
        "*Uses half as much fuel overall.\n",
        Dependency{ID, MineIron}
    );

    addAchievement(
        MineCoal,
        blockRegistry.getBlockByName("main:coalOre").iconMaterial,
        Material::coal,
        "Mine coal",
        "*Find {block|main:coalOre} underground and collect it.\n"
        "*Place the {block|main:grindingBowl} and right-click to open it.\n"
        "*Place the {block|main:coalOre} into the {inputSlot}.\n"
        "*Keep clicking the {action|Grind} button until the ore is processed.\n"
        "@itemProc|main:grindingBowl|main:coalOre|1|main:coal|1\n"
        "*Take the {item|main:coal} out of the bowl.\n",
        Dependency{BrickByBrickMilestone::ID, BrickByBrickMilestone::MakeGrindingBowl}
    );

    addAchievement(
        MakeSteel,
        Material::ironIngot,
        Material::steelIngot,
        "Make steel",
        "*Open the {action|chemical reactor}.\n"
        "*Place these items into the reactor:\n"
        "@itemList|main:chemicalReactor|main:battery|1|main:coil|8|main:ironIngot|1|main:coal|3\n"
        "*Ensure the battery is {action|charged}.\n"
        "*Switch the reactor {action|ON}.\n"
        "*As long as there is energy in the battery, the reactor will {action|heat up}.\n"
        "*Once hot enough, it will convert the {item|main:ironIngot} and {item|main:coal} into {item|main:steelIngot}.\n"
        "*Take the {item|main:steelIngot} out of the reactor.\n",
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::BuildChemicalReactor},
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::MakeBattery},
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::MakeCoil},
        Dependency{ID, MineCoal}
    );

    addAchievement(
        SteelPickaxe,
        Material::steelPickaxe,
        Material::steelPickaxe,
        "Construct the steel pickaxe",
        "*{action|Construct} the {item|main:steelPickaxe}.\n"
        "@constructTable|main:steelPickaxe|1|main:steelIngot|3|main:stick|8\n",
        Dependency{ID, MakeSteel}
    );

    addAchievement(
        MakeSiliconSheet,
        Material::siliconSheet,
        Material::siliconSheet,
        "Make silicon sheet",
        "*{action|Construct} the {item|main:siliconSheet}.\n"
        "@engTable|main:siliconSheet|1|main:siliconIngot|2\n",
        Dependency{ID, MineSilicon},
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::EngineeringTable}
    );
}