#pragma once

#include <string>
#include <vector>

// The kind of a single granted schematic within an unlock option.
enum class SchematicType
{
    Ship,
    Module,
    Building,
    Recipe
};

// One item granted by an unlock group (REQ-LOCK-EXPLICIT), shown in the
// schematic choice dialog's granted-items list.
struct GrantedSchematic
{
    SchematicType type;
    std::string id;
    std::string displayName;
};

// One recipe shown in an option's preview, together with the output groups the player
// would be able to get out of it afterwards -- indices into the recipe's own
// `outputGroups`, in config order (REQ-DEF-SCHEMATIC-DROP). The indices are what the
// preview draws: which groups a recipe can yield is decided here, against the unlock
// state as it would stand after the award, and not by the dialog against the current one.
struct PreviewedRecipe
{
    std::string      recipeId;
    std::vector<int> outputGroupIndices;
};

// One option presented to the player in the schematic choice dialog
// (REQ-DEF-SCHEMATIC-DROP). Built by the simulation when enemy stations are
// destroyed; the UI reads these to populate the dialog. A non-artifact option
// represents one unlock group; selecting it awards the whole group.
struct SchematicChoiceOption
{
    bool isArtifact = false;

    // Unlock group id (empty for the artifact option).
    std::string unlockGroupId;

    // Display name shown as the option's title: the unlock group's derived name,
    // or "Artifact" for the artifact option.
    std::string displayName;

    // The ships, modules, buildings, and assembler recipes this group grants
    // (empty for the artifact option).
    std::vector<GrantedSchematic> grantedItems;

    // What this option would add to the player's production options
    // (REQ-DEF-SCHEMATIC-DROP), each sorted alphabetically by display name. The unit is
    // usability rather than unlocking: a recipe is of no use while the building that
    // runs it cannot be placed, so unlocking that building is as much a gain as
    // unlocking the recipe was.
    //
    // Recipes the player could not use at all before and could after.
    std::vector<PreviewedRecipe> newlyUsableRecipes;
    // Recipes they could already use that would gain at least one further output group
    // -- a plant that starts yielding voidsteel is a real gain, and one a list of recipe
    // names alone cannot express.
    std::vector<PreviewedRecipe> upgradedRecipes;
};
