#ifndef SERVER_STARTER_H
#define SERVER_STARTER_H

#include <QObject>
#include "server.h"


class ServerStarter: public QObject {
	Q_OBJECT
public:
	ServerStarter();
	~ServerStarter();

	void setNoGraphics(bool on) {no_graphics = on;}
	bool isNoGraphics() const {return no_graphics;}
	void setReservation(bool on) {reservation = on;}
	bool isReservation() const {return reservation;}
	void close() {destroy();}
	void writePassword(const PIByteArray & ph);


public slots:
	void restart(QString baf = QString());
	void zeroFailure();

private:
	void init();
	void start();
	void destroy();
	bool checkFailure();
	void checkConfig();

	QString baf_path, src_baf_path, confpath, failpath;
	PIByteArray admin_password;
	double max_log_kb = 65.;
	bool no_graphics = false, log_add_time = false, log_add_dev = true, log_io = true, reservation = false;
	int max_failures = 3;

	Server * server = nullptr;

};

#endif // SERVER_STARTER_H
