#pragma once

#include <QWidget>
namespace Ui { class CMWAuthorityRole; };
#include "IAuthorityManager.h"
#include "csqliteauthoritymanager.h"

class CMWAuthorityRole : public QWidget, public IAuthoritySupport
{
	Q_OBJECT

public:
	CMWAuthorityRole(QWidget *parent = Q_NULLPTR);
	~CMWAuthorityRole();
	void FreshRole();
	void FreshPermission();
	void FreshPermissionState();
	void FocusSelectedRole();
	void SetAuthorityManager(IAuthorityManager* instance) override;
	void FreshAuthority() override;
	void InitAuthority() override;
private slots:
	void on_btnRefresh_clicked();
	void on_btnDel_clicked();
	void on_btnAdd_clicked();
	void on_btnModify_clicked();
	void on_btnModifyRole_clicked();
	void on_role_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
private:
	Ui::CMWAuthorityRole *ui;
	CSqliteAuthorityManager* m_AuthorityManager;
	int m_iSelRoleId = -1;
	int m_iLastUserSelRow = -1;
};
