#ifndef _BLOB_TRACKER_H
#define _BLOB_TRACKER_H


#include "ofMain.h"

#define OF_ADDON_USING_OFXVECTORMATH

#include "cardDef.h"
#include "ofAddons.h"

class cardTracker{
	
	public:
		
		cardTracker();
	
		~cardTracker();
		
	
		void setup(int timeToLiveMs);
		void resetCounter();

		int getCardDuration(int which);
		float getCardActivity(int which);
		
		//needs to be called before you can check cards
		void begin();
		
		bool matchTrackedCard(card & cardIn, int maxDist, float activityThresh = 2.0, float cacheRate = 0.85); //this returns true if the card matches - it also updates the card
		
		bool updateCardWithCache(card &cardIn);
		bool updateCacheWithCard(card &cardIn);
		
		int  getTrackedCardPictureId(card &cardIn);
		
		int addCard(card & cardIn);  //this will assign a new id 
		
		//once you are done checking cards
		//this kills cards that need to die!
		void end();
		
		void updateCardEnergyLevels();
	
	

		int numStoredCards;


	//protected:
		int width;
		int height;
		int lastNumFound;
		int genID;
		int lastTime;
		int deathTime;
		
		bool pictureIdInUse [MAX_TRACKED_CARDS];
		vector <card> storedCards;
				
};

#endif