#pragma once
//#pragma warning(disable:4251)
#include <vector>
#include <mutex>
#include <map>
#include "string.h"
#include "dt.h"
#include "CLog.h"

typedef enum
{
	CLOSE_BUTTON = 0x1,  //�ر�
	STOP_BUTTON = 0x2,  //��ֹ
	REPEAT_BUTTON = 0x4,//�ظ�
	IGNORE_BUTTON = 0x8,//����
}BUTTON_TYPE;

typedef struct
{
	int eViewButton;			//��������ʾ�İ�ť��BUTTON_TYPE�������
	LogStream::LogLevel iLevel;	//��������
	long iId;					//����Id
	std::string strDescribe;			//��������
	std::string strTip;				//������ʾ
	std::string strHelp;				//����������Ϣ
}MESSAGE_INFO;

//��������ص�����
typedef BUTTON_TYPE(*CallMessageBox) (MESSAGE_INFO stMsgInfo);

class __declspec(dllexport) CMessageBox
{
private:
	static std::mutex m_Mutex;
	static CMessageBox*  m_pMessageBox;

	std::vector<MESSAGE_INFO> m_vecMessageBox;
	CallMessageBox m_funCallMessageBox = nullptr;

	std::mutex m_PopBoxMutex;

	//������Ϣ����
	//void* m_pPubSocket;
	//void* m_pSubscriberSocket;

	long Init();
	void AddPopMassage(MESSAGE_INFO stMsgInfo);
	void ErasePopMassage(int iId);
public:
	// ��ȡ��ʵ������
	static long GetInstance(CMessageBox** pMsgBox);

	void SetCallMessageBoxFunc(CallMessageBox func);

	
	void ClearAllPopMassage();

	BUTTON_TYPE PopMassageBox(int eViewButton, LogStream::LogLevel iLevel, long iId,
		std::string strDescribe, std::string strTip="", std::string strHelp = "");
};