#pragma once
#include "Instances/CombatDragoonsVsDragoons.h"
#include "Instances/CombatTroopVsZerg.h"
#include "Instances/Corsair.h"
#include "Instances/CorsairVsScourge.h"
#include "Instances/MedicVsZerglings.h"
#include "Instances/Observer.h"
#include "Instances/ProbeMove.h"
#include "Instances/PsionicStorm.h"
#include "Instances/Reavers.h"
#include "Instances/TestBuild.h"
#include "Instances/TestCancelBuild.h"
#include "Instances/TestResearch.h"
#include "Instances/TestObserverTurrets.h"
#include "Instances/TestRetreat.h"
#include "Instances/TestSensingVsTerran.h"
#include "Instances/TestSensingVsProtoss.h"

/**
 * @brief Static class regrouping all functions used to instantiate scenario-specific SPAR instances.
 */
class Scenarios
{
public:
  template <class SparAIFactory>
  static SparAIContainer* instantiateSparAIForScenarios(SparAIFactory& factory)
  {
    const std::string mapName = BWAPI::Broodwar->mapName();
    if (mapName == "InactiveAI")
    {
      return factory.instantiate<Layer1GameState, Layer2Cueing, Layer3TacticalRecognition, Layer4StrategicRecognition,
                                 InactiveLayer1, InactiveLayer2, InactiveLayer3, InactiveLayer4>(NULL);
    }
    else if (mapName == "MedicVsZerglings")
    {
      return (new MedicVsZerglingsScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "CombatDragoonsVsDragoons")
    {
      return (new CombatDragoonsVsDragoonsScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "CombatTroopVsZerg")
    {
      return (new CombatTroopVsZergScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "Reavers")
    {
      return (new ReaversScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "ProbeMove")
    {
      return (new ProbeMoveScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "Observer")
    {
      return (new ObserverScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "Corsair")
    {
      return (new CorsairScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "CorsairVsScourge")
    {
      return (new CorsairVsScourgeScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "TestBuild")
    {
      return (new TestBuildScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "TestCancelBuild")
    {
      return (new TestCancelBuildScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "TestResearch")
    {
      return (new TestResearchScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "TestRetreat")
    {
      return (new TestRetreatScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "TestSensingVsTerran")
    {
      return (new TestSensingVsTerranScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "TestSensingVsProtoss")
    {
      return (new TestSensingVsProtossScenario())->instantiateSparAI(factory);
    }
    else if (mapName == "TestObserverTurrets")
    {
      return (new TestObserverTurretsScenario())->instantiateSparAI(factory);
    }
    else if (mapName.substr(0, 12) == "PsionicStorm")
    {
      return (new PsionicStormScenario())->instantiateSparAI(factory);
    }
    else
    {
      return NULL;
    }
  }
};
