#include "DroneOwnedStates.h"
#include "State.h"
#include "Drone.h"


#include <iostream>
using namespace std;
void InWork::Enter(Drone* pDrone)
{
   		  cout<<"\n oh no not another day in work\n";
}
void InWork::Execute(Drone* pDrone)
{ 
   if (pDrone->homeTime())
	  {
		  pDrone->ChangeState(AtHome::Instance());

	  }
}

void InWork::Exit(Drone* pDrone)
{
   //do stuff here associated with leaving this state,
	//e.g log off computer, sign out, etc.
	cout<<"\n Yippee end of work for now!\n";
}

  //singlton - static creates one common global state for all to use
InWork* InWork::Instance()
  {
      static InWork instance;
      return &instance;
  }

//  AtHome state definitions 

AtHome* AtHome::Instance()
  {
      static AtHome instance;
      return &instance;
  }

void AtHome::Execute(Drone* pDrone)
//do stuff here associated with state e.g. sleep, cook dinner,etc
//also contains logic for changinging states.
  {
	  if (pDrone->timeForWork())
	  {
		  pDrone->ChangeState(InWork::Instance());

	  }
  }

void AtHome::Enter(Drone* pDrone)
{
   //do stuff here like hanging up cout, etc.
	cout<<"\n Home Sweet Home\n";
}

void AtHome::Exit(Drone* pDrone)
{
   //do stuff here associated with leaving this state,
	//e.g turn lights off, lock door, etc.
	cout<<"\n Locking the door and leaving the house.\n";
}
