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

const std::string HydraulicsMilestone::ID = "main:Hydraulics";

HydraulicsMilestone::HydraulicsMilestone() :
    Milestone(
        Material::capsuleSmallTin,
        Material::capsuleLargeTin,
        "Hydraulics"
    )
{
    addAchievement(
        MakeSmallTinCapsule,
        Material::capsuleSmallTin,
        Material::capsuleSmallTin,
        "Make a small tin capsule",
        "*{action|Construct} {item|main:capsuleSmallTin}.\n"
        "@constructTable|main:capsuleSmallTin|1|main:tinIngot|8\n",
        Dependency{BronzeAgeMilestone::ID, BronzeAgeMilestone::MineTin}
    );

    addAchievement(
        MakeLargeTinCapsule,
        Material::capsuleLargeTin,
        Material::capsuleLargeTin,
        "Make a large tin capsule",
        "*{action|Construct} {item|main:capsuleLargeTin}.\n"
        "@constructTable|main:capsuleLargeTin|1|main:capsuleSmallTin|1|main:tinIngot|24\n",
        Dependency{BronzeAgeMilestone::ID, BronzeAgeMilestone::MineTin},
        Dependency{ID, MakeSmallTinCapsule}
    );

    addAchievement(
        CollectWater,
        Material::capsuleLargeTin,
        Material::capsuleLargeTin,
        "Collect water",
        "*Select a {action|capsule} from the sidebar.\n"
        "*Find {action|water} in a lake or the sea.\n"
        "*Right-click on water with the capsule to collect it.\n",
        Dependency{ID, MakeSmallTinCapsule}
    );

    addAchievement(
        MakeFluidPipe,
        blockRegistry.getBlockByName("main:fluidPipe").iconMaterial,
        blockRegistry.getBlockByName("main:fluidPipe").iconMaterial,
        "Make fluid pipes",
        "*{action|Construct} {block|main:fluidPipe|16}.\n"
        "@constructTable|main:fluidPipe|16|main:ironIngot|3\n",
        Dependency{MetalWorkingMilestone::ID, MetalWorkingMilestone::MineIron}
    );

    addAchievement(
        MakeWoodenBarrel,
        blockRegistry.getBlockByName("main:woodenBarrel").iconMaterial,
        blockRegistry.getBlockByName("main:woodenBarrel").iconMaterial,
        "Make a wooden barrel",
        "*{action|Construct} {block|main:woodenBarrel|1}.\n"
        "@constructTable|main:woodenBarrel|1|main:planks|12|main:ironIngot|2\n",
        Dependency{MetalWorkingMilestone::ID, MetalWorkingMilestone::MineIron}
    );

    addAchievement(
        MakeSteelBarrel,
        blockRegistry.getBlockByName("main:steelBarrel").iconMaterial,
        blockRegistry.getBlockByName("main:steelBarrel").iconMaterial,
        "Make a steel barrel",
        "*{action|Construct} {block|main:steelBarrel|1}.\n"
        "@engTable|main:steelBarrel|1|main:woodenBarrel|1|main:steelIngot|12\n",
        Dependency{ID, MakeWoodenBarrel},
        Dependency{MetalWorkingMilestone::ID, MetalWorkingMilestone::MakeSteel},
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::EngineeringTable}
    );

    addAchievement(
        MakeLeadBarrel,
        blockRegistry.getBlockByName("main:leadBarrel").iconMaterial,
        blockRegistry.getBlockByName("main:leadBarrel").iconMaterial,
        "Make a lead barrel",
        "*{action|Construct} {block|main:leadBarrel|1}.\n"
        "@engTable|main:leadBarrel|1|main:steelBarrel|1|main:leadIngot|12\n",
        Dependency{ID, MakeSteelBarrel},
        Dependency{MetalWorkingMilestone::ID, MetalWorkingMilestone::MineLead},
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::EngineeringTable}
    );

    addAchievement(
        MakePump,
        blockRegistry.getBlockByName("main:pump").iconMaterial,
        blockRegistry.getBlockByName("main:pump").iconMaterial,
        "Make a pump",
        "*{action|Construct} {block|main:pump|1}.\n"
        "@constructTable|main:pump|1|main:fluidPipe|1|main:tinIngot|6|main:ironIngot|2|main:copperWire|3\n",
        Dependency{ID, MakeFluidPipe},
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::MakeCopperWire}
    );

    addAchievement(
        ManualPump,
        blockRegistry.getBlockByName("main:pump").iconMaterial,
        blockRegistry.getBlockByName("main:pump").iconMaterial,
        "Pump manually",
        "*{action|Place} a {block|main:pump} directly on top of a water block.\n"
        "*By {action|placing} {block|main:fluidPipe}, connect the top of the pump ({icon|fluidOutputIcon})"
        " to the top of a {block|main:woodenBarrel} or {block|main:steamGenerator}.\n"
        "*Right-click the {block|main:pump} to open it.\n"
        "*Click the {action|Pump Manually} button. If water is moved, you'll get this achievement.",
        Dependency{ID, MakePump}
    );
}