
#ifndef _CONFIGURATION_H_
#define _CONFIGURATION_H_

/*
 * all configuration data will loaded and saved from here.
 */

#include <string>
#include <list>
#include "simpleskycam.h"
#include "videodev.h"
#include "json.h"

#define CONFIGURATION_DEFAULTFILE ".simpleskycam.config"
#define BTN_PRESET_MAX	4		// number of preset buttons

class Configuration {
private:
	int histogram_log = 1;			// logarithmic or linear scale
	int calibration_showdata = 0;	// needed for debugging calibration
	std::string destpath;			// destination path
	JSONParse config;
	std::string GetDefaultFileName();
	list<VideoDevCtrl> presetbtn[BTN_PRESET_MAX];
public:
	char *debugpath;
	char *readdumppath;
	int debayer_mode = 0;			// 0..simple mode, 1..bilinear
	int show_debugwin = 0;

	Configuration();
	~Configuration();

	void LoadDefault();
	void SaveDefault();

	void LoadConfig(std::string filename);
	void SaveConfig(std::string filename);

	void SetDebayerMode(int trueorfalse);

	void SetDestPath (std::string dest) { destpath = dest; };
	std::string GetDestPath() { return destpath; };

	void SetHistogramLog(int trueorfalse);
	int GetHistogramLog() { return histogram_log; };

	void SetCalibrationShowData(int enabled) { calibration_showdata = enabled; };
	int GetCalibrationShowData() { return calibration_showdata; };

	void SetPresetButton (int btn, list<VideoDevCtrl> *parameters);
	list<VideoDevCtrl> GetPresetButton (int btn);
};

extern Configuration config;

#endif
