#pragma once
#include "../../../Behaviors/General/EngageEnemies/EngageEnemiesBehavior.h"
#include "../../../../../../Utils/Process/ProcessContainer.h"

class SplitGroupCarefulAttackBehavior : public EngageEnemiesBehaviorT<SplitGroupCarefulAttackBehavior>
{
protected:
  //class Engaging;
  //friend class Engaging;

  /**
  * @brief The Engaging state is active when the group is engaging the enemies.
  *        New sub-behaviors are spawned upon entering this state.
  */
  class Engaging : public BehaviorStateT<SplitGroupCarefulAttackBehavior, Engaging>
  {
  public:
    Engaging(SplitGroupCarefulAttackBehavior& behavior, const std::set<BWAPI::Unit*>& enemyUnits);
    void onEnter();
    void onExit();

    typedef boost::tuple<
    > Events;
		const Events m_events;

    typedef boost::tuple<
    > Transitions;
		const Transitions m_transitions;

  protected:
    // Variables
    const BWAPI::Position m_enemyCenter;
    ProcessContainer<GroupBehavior> m_groupBehavior;

    // Actions

    // Transitions
  };

public:
  SplitGroupCarefulAttackBehavior(const Process* parent, unsigned int initialPriority, const PersistentUnitGroup* group, const std::set<BWAPI::Unit*>& enemyUnits)
    : EngageEnemiesBehaviorT(parent, initialPriority, group)
    , EngageEnemiesBehavior(parent, initialPriority, group)
    , GroupBehavior(parent, initialPriority, group)
    , Behavior(parent, initialPriority)
    , FSM(parent)
    , Process(parent)
    , m_engagingState(*this, enemyUnits)
    , m_states(m_engagingState)
  {
  }

  virtual void onUnitAddedToGroup(void* data, BWAPI::Unit* unit)
  {
    unused(data);
    unused(unit);
  }

  virtual void onUnitRemovedFromGroup(void* data, BWAPI::Unit* unit)
  {
    unused(data);
    unused(unit);
  }

  typedef boost::tuple<
      Engaging&
    > States;
	const States m_states;

protected:
  virtual void onStart()
  {
    EngageEnemiesBehaviorT::onStart();
    m_engagingState.enter();
  }

  // Arguments

  // Variables

  // States
  Engaging m_engagingState;
};
