using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using bbiwarg.Recognition.Tracking;
using bbiwarg.Utility;

namespace bbiwarg.Recognition.FingerRecognition
{
    class FingerTracker : Tracker<Finger>
    {
        public List<Finger> Fingers { get { return TrackedObjects; } }

        public FingerTracker()
            : base(Constants.FingerNumFramesDetectedUntilTracked, Constants.FingerNumFramesLostUntilDeleted, Constants.FingerMinSimilarityForTracking)
        {
        }

        protected override void onDetect(object sender, EventArgs e)
        {
            TrackableObjectHistory<Finger> history = (TrackableObjectHistory<Finger>)sender;
            if (history.NumFramesInCurrentState == 1)
                Logger.log("Finger #" + history.ID.ToString() + " detected", LogSubject.FingerTracker);
        }

        protected override void onTrack(object sender, EventArgs e)
        {
            TrackableObjectHistory<Finger> history = (TrackableObjectHistory<Finger>)sender;
            if (history.NumFramesInCurrentState == 1)
                Logger.log("Finger #" + history.ID.ToString() + " tracked", LogSubject.FingerTracker);
        }

        protected override void onRetrack(object sender, EventArgs e)
        {
            TrackableObjectHistory<Finger> history = (TrackableObjectHistory<Finger>)sender;
            if (history.NumFramesInCurrentState == 1)
                Logger.log("Finger #" + history.ID.ToString() + " retracked", LogSubject.FingerTracker);
        }

        protected override void onLoose(object sender, EventArgs e)
        {
            TrackableObjectHistory<Finger> history = (TrackableObjectHistory<Finger>)sender;
            if (history.NumFramesInCurrentState == 1)
                Logger.log("Finger #" + history.ID.ToString() + " lost", LogSubject.FingerTracker);
        }

        protected override void onDelete(object sender, EventArgs e)
        {
            TrackableObjectHistory<Finger> history = (TrackableObjectHistory<Finger>)sender;
            if (history.NumFramesInCurrentState == 1)
                Logger.log("Finger #" + history.ID.ToString() + " deleted", LogSubject.FingerTracker);
        }
    }
}
