﻿#pragma once

#include <iostream> // Allows for simple input and output functions
#include <fstream>  // Allows for simple file controls
#include <filesystem>   // Allows for more advanced file controls
#include <map>  // Allows the use of maps (dictionaries)
#include <set> // Allows for sorted arrays, so like vectors dynamically, but they keep a sorted fashion
#include <atomic> // For async functions
#include <future> // Async functions also
#include "Utilities.h" // Utilities that I have created to use for ease of coding
#include "Selection.h" // Adds selections for input, makes it so there is no user input error :D
#include "Async.h" // Has async functions that are not utilizing variables from this header such as creating an async function, or defining them 

#define GAMEHEADER R"(                                                                    
     ,---,             ,--,                       ,----..                         ____           
  ,`--.' |      ,---,,--.'|                      /   /   \                      ,'  , `.         
  |   :  :    ,---.'||  | :                     |   :     :                  ,-+-,.' _ |         
  :   |  '    |   | ::  : '                     .   |  ;. /               ,-+-. ;   , ||         
  |   :  |    |   | ||  ' |      ,---.          .   ; /--`    ,--.--.    ,--.'|'   |  || ,---.   
  '   '  ;  ,--.__| |'  | |     /     \         ;   | ;  __  /       \  |   |  ,', |  |,/     \  
  |   |  | /   ,'   ||  | :    /    /  |        |   : |.' .'.--.  .-. | |   | /  | |--'/    /  | 
  '   :  ;.   '  /  |'  : |__ .    ' / |        .   | '_.' : \__\/: . . |   : |  | ,  .    ' / | 
  |   |  ''   ; |:  ||  | '.'|'   ;   /|        '   ; : \  | ," .--.; | |   : |  |/   '   ;   /| 
  '   :  ||   | '/  ';  :    ;'   |  / |        '   | '/  .'/  /  ,.  | |   | |`-'    '   |  / | 
  ;   |.' |   :    :||  ,   / |   :    |        |   :    / ;  :   .'   \|   ;/        |   :    | 
  '---'    \   \  /   ---`-'   \   \  /          \   \ .'  |  ,     .-./'---'          \   \  /  
            `----'              `----'            `---`     `--`---'                    `----'   
)"

struct gameState
{
    // Money you start with
    int money = 50;

    // Time you have spent in the idle game
    int currentSeconds = 0;

    // Array of items you own
    std::vector<std::string> itemsYouOwn;
    
};

// Game state variable to get the money, current time and items you own (It also makes it easier to read what variables are not generated in the code and such)
inline gameState gameInfo;

// This is so I can change the save location easier
inline std::string highScoreFile = "HighScore.txt";

// View money bool
inline bool bViewMoney = false;

// Struct def for items, this will allow me to keep things relating to the items together in one set of variables
struct itemDecelerations
{
    int price;
    int moneyEachPayout;
};

// Allows me to get items using a key and then get the price and such from that
inline std::map<std::string, itemDecelerations> items
{
    {"car",{50, 5}},
    {"house",{100, 15}},
    {"boat",{150, 25}},
    {"plane",{200, 35}},
    {"spaceship",{250, 45}}
};

// Function to buy an item
void BuyItem();

// Function to update the money you have basically an idle game.
void ViewMoney();

// Function to show high score
void HighScore();

// Main function of the game menu
void MainGame();

// Function to save the game
void SaveGame();

// Function to exit the game, making parts of my code more modular
void ExitGame();

// Function to quit from the main menu
void Quit();

// Function to convert a string into an int (Replacement for "std::stoi")!
int ConvertToInt(const std::string& stringInput);

// Converts a number to a number with comas to show money e.g. 300200100 to 300,200,100.
std::string ConvertToCurrency(const std::string& stringInput);
