#include "game.h"
#include <iostream>
#include <sstream>
#include <string>

// This is a reconstructed state-transition slice, not the complete archived RPG.
int main() {
    Player player;
    std::string line;
    while (std::cout << "1 potion, 2/3/4 record core, 5 status, 0 exit: " && std::getline(std::cin, line)) {
        std::istringstream input(line);
        int choice = -1;
        char extra = '\0';
        if (!(input >> choice) || input >> extra || choice < 0 || choice > 5) {
            std::cout << "Invalid menu choice.\n";
            continue;
        }
        if (choice == 0) break;
        if (choice == 1) std::cout << (buyPotion(player) ? "Potion purchased." : "Insufficient gold.") << '\n';
        else if (choice >= 2 && choice <= 4) grantCore(player, static_cast<Core>(choice - 2));
        else std::cout << "Gold: " << player.gold << ", potions: " << player.potions
                       << ", boss: " << (bossUnlocked(player) ? "unlocked" : "locked") << '\n';
    }
    std::cout << "Session ended.\n";
}
