#ifndef ChronoReadingManager_H
#define ChronoReadingManager_H

#include <Arduino.h>
#include "ChronoReading.h"
#include "ChronoProfile.h"
#include "GunProfile.h"
#include "ProjectileProfile.h"
#include <LinkedList.h>

class ChronoReadingManager {
  public:

    // Constructor: Called when a ChronoReadingManager object is created
    static ChronoReadingManager& getInstance();
    void initializeProfiles();
    void addReading(int fps);
    int getLowFPS();
    int getHighFPS();
    int getAvgFPS();
    float getStandardDeviation();
    int getShotCount();
    int getSpread();
    int getLastFPS();
    int getLastFPE();
    LinkedList<ChronoReading>& getChronographReadings();
    ChronoProfile& getProfile();
    void addProjectileProfile(ProjectileProfile profile, bool writeToDisk = true);
    LinkedList<ProjectileProfile>& getProjectileProfiles();
    void setProjectileProfile(int id);
    void removeProjectileProfile(int id);
    void addGunProfile(GunProfile profile, bool writeToDisk = true);
    LinkedList<GunProfile>& getGunProfiles();
    void setGunProfile(int id);
    void removeGunProfile(int id);
    void reset();

  private:
    ChronoReadingManager();
    ChronoReadingManager(const ChronoReadingManager&) = delete;
    ChronoReadingManager& operator=(const ChronoReadingManager&) = delete;
    LinkedList<ChronoReading> _chronoReadings;
    LinkedList<GunProfile> _gunProfiles;
    LinkedList<ProjectileProfile> _projectileProfiles;
    ChronoProfile* _currentProfile;

};

#endif