#include <BlockRegistry/BlockRegistry.hpp>
#include <Milestone/FossilFuelsMilestone/FossilFuelsMilestone.hpp>
#include <Milestone/HydraulicsMilestone/HydraulicsMilestone.hpp>
#include <Milestone/ElectronicsMilestone/ElectronicsMilestone.hpp>
#include <Milestone/MetalWorkingMilestone/MetalWorkingMilestone.hpp>

const std::string FossilFuelsMilestone::ID = "main:FossilFuels";

FossilFuelsMilestone::FossilFuelsMilestone() :
    Milestone(
        blockRegistry.getBlockByName("main:combustionGenerator").iconMaterial,
        blockRegistry.getBlockByName("main:combustionGenerator").iconMaterial,
        "Fossil Fuels"
    )
{
    addAchievement(
        CollectOil,
        Material::capsuleLargeTin,
        Material::capsuleLargeTin,
        "Collect crude oil",
        "*Select a {action|capsule} from the sidebar.\n"
        "*Find {action|crude oil} in deposits on a desert.\n"
        "*Right-click on crude oil with the capsule to collect it.\n",
        Dependency{HydraulicsMilestone::ID, HydraulicsMilestone::MakeSmallTinCapsule}
    );

    addAchievement(
        OilRefinery,
        blockRegistry.getBlockByName("main:oilRefinery").iconMaterial,
        blockRegistry.getBlockByName("main:oilRefinery").iconMaterial,
        "Oil refinery",
        "*Open the {machine|main:engineeringTable}.\n"
        "*In the {icon|recipeBookIcon}{menu|Recipes} tab, {action|SET} the {block|main:oilRefinery} recipe.\n"
        "*Place the ingredients into the inputs slots on the left.\n"
        "*Power the engineering table by placing a {item|main:battery} in the {rechargeSlot},"
        " or by connecting power through {block|main:copperWire}.\n"
        "*Wait for {block|main:oilRefinery} to be constructed, and pick it up.\n"
        "@engTable|main:oilRefinery|1|main:steelIngot|6|main:fluidPipe|8|main:coil|10|"
            "main:copperWire|1|main:battery|1|main:glass|2\n"
        "*Place the {machine|main:oilRefinery} and open it.\n",
        Dependency{HydraulicsMilestone::ID, HydraulicsMilestone::MakeFluidPipe},
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::MakeCoil},
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::MakeBattery},
        Dependency{MetalWorkingMilestone::ID, MetalWorkingMilestone::MineIron},
        Dependency{MetalWorkingMilestone::ID, MetalWorkingMilestone::MakeSteel},
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::EngineeringTable}
    );

    addAchievement(
        LoadOil,
        Material::capsuleLargeTin,
        Material::capsuleLargeTin,
        "Load oil into the refinery",
        "*Collect crude oil into a capsule and load it into the {oilSlot} of an {machine|main:oilRefinery}.\n"
        "#OR\n"
        "*Use a {block|main:pump} over a crude oil deposit to pump it into the {icon|fluidInputIcon}{menu|fluid input}"
        " side of an {machine|main:oilRefinery}.\n",
        Dependency{ID, OilRefinery}
    );

    addAchievement(
        RefineOil,
        blockRegistry.getBlockByName("main:oilRefinery").iconMaterial,
        blockRegistry.getBlockByName("main:oilRefinery").iconMaterial,
        "Refine crude oil",
        "*Open an {machine|main:oilRefinery}.\n"
        "*Make sure crude oil is loaded into it.\n"
        "*Power the refinery by inserting a {item|main:battery} into the {rechargeSlot}, or by connecting"
        " the {icon|electricInputIcon}{menu|electric input} side to a power source.\n"
        "*Turn the refinery {action|ON}.\n"
        "*Petrol will now be produced and stored in the refinery. You can extract it using the {petrolSlot}"
        " or by pumpuing out of the {icon|fluidOutputIcon}{menu|fluid output} side.",
        Dependency{ID, LoadOil}
    );

    addAchievement(
        CombustionGenerator,
        blockRegistry.getBlockByName("main:combustionGenerator").iconMaterial,
        blockRegistry.getBlockByName("main:combustionGenerator").iconMaterial,
        "Combustion generator",
        "*Open the {machine|main:engineeringTable}.\n"
        "*In the {icon|recipeBookIcon}{menu|Recipes} tab, {action|SET} the {block|main:combustionGenerator} recipe.\n"
        "*Place the ingredients into the inputs slots on the left.\n"
        "*Power the engineering table by placing a {item|main:battery} in the {rechargeSlot},"
        " or by connecting power through {block|main:copperWire}.\n"
        "*Wait for {block|main:combustionGenerator} to be constructed, and pick it up.\n"
        "@engTable|main:combustionGenerator|1|main:steelIngot|6|main:goldIngot|4|main:battery|1|"
            "main:glass|3|main:copperWire|2|main:fluidPipe|2\n"
        "*Place the {machine|main:combustionGenerator} and open it.\n",
        Dependency{MetalWorkingMilestone::ID, MetalWorkingMilestone::MakeSteel},
        Dependency{ElectronicsMilestone::ID, ElectronicsMilestone::EngineeringTable},
        Dependency{MetalWorkingMilestone::ID, MetalWorkingMilestone::MineGold},
        Dependency{HydraulicsMilestone::ID, HydraulicsMilestone::MakeFluidPipe}
    );

    addAchievement(
        GenerateCombustionEnergy,
        blockRegistry.getBlockByName("main:combustionGenerator").iconMaterial,
        blockRegistry.getBlockByName("main:combustionGenerator").iconMaterial,
        "Generate energy with combustion",
        "*Load petrol into a {machine|main:combustionGenerator} using the {petrolSlot}, or by pumping it"
        " into the {icon|fluidInputIcon}{menu|fluid input} side (top).\n"
        "*You could pump it directly from an {machine|main:oilRefinery}.\n"
        "*Turn the generator {action|ON}.\n"
        "*The generator will consume petrol and produce energy.",
        Dependency{ID, CombustionGenerator},
        Dependency{ID, RefineOil}
    );
}