#pragma once

#include <BWAPI.h>
#include "BWEM/src/bwem.h"

#include "Analysis.h"
#include "BuildingPlacement.h"
#include "CBase.h"
#include "CPlayer.h"
#include "CUnit.h"
#include "Location.h"
#include "QueueEntry.h"
#include "Squad.h"
#include "Util.h"

using namespace BWAPI;
class CBase;
class CPlayer;
class CUnit;
class QueueEntry;
class Squad;


class Macro
{
	// all functions and variables are sorted by category here but are alphabetical in the macro.cpp file

public:
	static std::vector<CBase> bases;
	static std::vector<CPlayer> players;
	static std::vector<QueueEntry> queue; // a function will then pick from the queue what's most important right now
	static std::vector<CUnit> scouts;
	static std::vector<Squad> squads;
	static int selfID;
	static void setSelfID(int);
	static std::vector<int> enemyIDs;
	static void setEnemyID(int id);

	// macro functions
	static void analyzeQueue();
	static void freeUnit(int index);
	static CUnit getTrainingBase();
	static TilePosition lastBuildLocation;
	static void setLastBuildLocation(TilePosition tp);
	static bool macroHatch;
	static void morphCreepColonies();
	static bool newBase;
	static void setMacroHatch(bool);
	static void setNewBase(bool);
	static bool stopProduction;
	static void setStopProduction(bool status);

	static int lastAttack;
	static void setLastAttack(int frame);
	static TilePosition lastAttackLocation;

	// map functions
	static void addBase(TilePosition tp);
	static void addLocation(TilePosition tp, bool startLocation);
	static void assignBase(int playerID, CBase base);
	static std::vector<Location> locations;

	// utility / event functions
	static void addPlayer(BWAPI::Player player);
	static void addSquad();
	static int findMiningBase(BWAPI::Unit unit, std::string type);
	static void onUnitComplete(Unit unit);
	static void onUnitCreate(Unit unit);
	static void onUnitDestroy(Unit unit);
	static void onUnitDiscover(Unit unit);
	static void onUnitMorph(Unit unit);
	static void onUnitShow(Unit unit);
	static int queueCount(BWAPI::UnitType unit);
	static bool queueHas(BWAPI::TechType tech);
	static bool queueHas(BWAPI::UnitType unit);
	static bool queueHas(BWAPI::UpgradeType upgrade);
	
	// scouting
	static bool workerScout;
};