#ifndef NETWORKMANAGER_H
#define NETWORKMANAGER_H

#include <QObject>
#include <QString>

#include "json/jsonobject.h"

class NetworkManager : public QObject
{
	Q_OBJECT
public:
	static host getLocalHost();
	static bool setLocalHost(const host& h);
	//static NetworkManager* Instance();
	//static void qIfConfig(const localhost& lhost);
	static QString interfaceName();
	static bool isDHCP();
	static IpAddr getDefaultIpAddr();
	static QList<QStringList> getIpAddrList();
	static QString getDefaultGateway();
	static QList<QStringList> getIpRouteList();

	//static void setInterfaceName(const QString& name);
	static bool checkPassWord(const QString& pwd, QString& err_info);
	static bool restart(QString& err_info);
	static bool setJsonDHCP(bool enable);

	static bool setDefaultIpAddr(const IpAddr& addr, QString& err_info);
	static bool setIpAddrList(const QList<QStringList>& list, QString& err_info);
	static bool setDefaultGateway(const QString& gw, QString& err_info);
	static bool setIpRouteList(const QList<QStringList>& list, QString& err_info);
	static QString NewExp(QString ip, QString mask);

	static bool validate(const QString& addr);

	static bool testSetMode(QString& err_info);
	static void testGetMode();

	//private:
		//explicit NetworkManager(QObject* parent = nullptr);
		//static NetworkManager* instance;


		//QString InterfaceName;
		//bool isDHCP;
		//IpAddress default_IpAddr;
		//QList<IpAddress> addresses;

		//IpRoute default_IpRoute;
		//QList<IpRoute> routes;



};

#endif // NETWORKMANAGER_H
