#pragma once
#include "Event.h"
#include "SuitFactory.h"
#include "Suit.h"
#include "ProcessSuit.h"
#include "SimulatorSingleton.h"
using namespace std;

class Arrival: public Event
{
public:
	Arrival(double time, int _arrivalsRate):Event(time){arrivalsRate = _arrivalsRate;}
	int arrivalsRate;
	void Event::action()
	{	
		SimulatorSingleton *sim = SimulatorSingleton::instance();
		double timeArrival = sim->rStreamManager->rStream7->exponential(arrivalsRate);
		double timeServiceProcessSuit = sim->rStreamManager->rStream1->exponential(6);
		ProcessSuit *processSuit = new ProcessSuit(timeServiceProcessSuit + getTime());

		SuitFactory *suitFactory = SuitFactory::instance();
		Suit newSuit = suitFactory->createNewSuit();
		newSuit.setInitialTime(getTime());
		processSuit->suit = newSuit;
		sim->add_event(processSuit);

		Arrival *arrival = new Arrival(timeArrival + getTime(),arrivalsRate);
		sim->add_event(arrival);
	}

	int Event::getType()
	{
		return 0;
	}

	Suit suit;
};