#ifndef MSKlient_H
#define MSKlient_H

#include <Klient.h>
#include <Text.h>
#include <Array.h>

using namespace Network;
using namespace Framework;

struct ServerData
{
    int id;
    Text name;
    Text ip;
    unsigned short port;
    unsigned short adminPort;
    Text status;
};

struct ServerDetails
{
    Text name;
    Text ip;
    unsigned short port;
    unsigned short adminPort;
    int tasks;
    int maxTasks;
};

class MSKlient
{
private:
	SSLKlient *k;
	CRITICAL_SECTION cs;
	Text *fehler;
	Text *ip;
	int port;
	bool verbunden;
	bool eingeloggt;
	int ref;

public:
	// Konstruktor
	MSKlient( const char *ip, int port );
	// Destruktor
	~MSKlient();
	// nicht constant
	void lock();
	void unlock();
	bool verbinden();
	bool login( const char *name, const char *passwort );
	bool logout();
	int getStatus();
	bool pause();
	bool fortsetzen();
	bool beenden();
	bool terminieren();
    bool getPatchServerListe( Array< ServerData* > *list );
    bool getPatchServerDetails( int id, ServerDetails *details );
	bool trenne();
	// constant
	bool istVerbunden() const;
	bool istEingeloggt() const;
	const char *getLetzterFehler() const;
	// Reference Counting
	MSKlient *getThis();
	MSKlient *release();
};

#endif