#pragma once
#include "../Scenario.h"
#include "../../PerceptualState/Locations/Static/AutoPopulated/Map.h"

class TestResearchScenario : public Scenario<TestResearchScenario>
{
public:
  TestResearchScenario()
    : m_researches(*this)
  {}

  template <class SparAIFactory>
  SparAIContainer* instantiateSparAIImpl(SparAIFactory& sparFactory)
  {
    typedef SparAIModule<Layer1GameState, Layer2Cueing, Layer3TacticalRecognition, Layer4StrategicRecognition,
                         Layer1FSM, Layer2Managers, InactiveLayer3, InactiveLayer4> SPAR;

    return sparFactory.instantiate<Layer1GameState, Layer2Cueing, Layer3TacticalRecognition, Layer4StrategicRecognition,
                                   Layer1FSM, Layer2Managers, InactiveLayer3, InactiveLayer4>(this);
  }

protected:
  virtual void onSparStarted(void* data)
  {
    {
      Research* research1 = Layer2Managers::getInstance().instantiateUpgradeResearch(
          this,
          100,
          CurrentWorld::getUpgradeTypeObject(BWAPI::UpgradeTypes::Protoss_Ground_Weapons, 1)
        );
      m_researches.add(research1);
      research1->start();
    }
    {
      Research* research2 = Layer2Managers::getInstance().instantiateUpgradeResearch(
          this,
          100,
          CurrentWorld::getUpgradeTypeObject(BWAPI::UpgradeTypes::Protoss_Ground_Armor, 1)
        );
      m_researches.add(research2);
      research2->start();
    }
    {
      Research* research3 = Layer2Managers::getInstance().instantiateUpgradeResearch(
          this,
          100,
          CurrentWorld::getUpgradeTypeObject(BWAPI::UpgradeTypes::Protoss_Plasma_Shields, 1)
        );
      m_researches.add(research3);
      research3->start();
    }
  }

  void _output(std::ostream &out) const
  {
    out << "TestResearch Scenario";
  }

  ProcessContainerList<Research> m_researches;
};