/*******************************************************************************
//
//	ftprn_structs.h
//
//	Printer for Remote Desktop
//
//	API structures declaration
//
//	Copyright (c) FabulaTech
//
*******************************************************************************/

#pragma once

#include <Windows.h>

#define PRINTER_MAME_LENGTH	256

typedef struct FT_PRINTER
{
	DWORD dwUniqId;
	BOOL  bSelected;
	WCHAR wsName[PRINTER_MAME_LENGTH];
	WCHAR wsVirtName[PRINTER_MAME_LENGTH];
#ifdef __cplusplus
	bool operator == (const FT_PRINTER& ftPrn)
	{
		if (wcscmp(ftPrn.wsName, wsName) == 0) return (true);
		else return (false);
	}
#endif
} ftPrinter;

typedef enum 
{
	evPrinterUnplugged = 50,
	evPrinterPlugged,
	evPrintersListed, // all printers are listed,

	evSvcStarted,
	evSvcStopped,

	evRdpConnected,
	evRdpNotConnected,
	evRdpConnectionBroken,
	evRdpInvalidProtocol,

	evLicOk,					/* lic notifications */
	evLicLicenseExceeding,
	evLicLicenseExpired,
	evLicNoMoreSublicenses,
	evLicSublicReleased,
	evLicAcquiredLocally,
	evLicAcquiredBySrv,
	evLicReleasedLocally,
	evLicReleasedBySrv,
	evLicSrvSessionOpened,
	evLicSrvSessionClosed,
	evLicGeneralError,
	evLicStatNotConnected,
	evLicStatNotifyNotConnected
} FT_PRINTER_EVENT;

#ifdef __cplusplus
inline LPCWSTR enum_str_printer(FT_PRINTER_EVENT eValue)
{
	switch (eValue)
	{
	case evPrinterUnplugged: return L"evPrinterUnplugged";
	case evPrinterPlugged: return L"evPrinterPlugged";
	case evPrintersListed: return L"evPrintersListed";

	case evSvcStarted: return L"evSvcStarted";
	case evSvcStopped: return L"evSvcStopped";

	case evRdpConnected: return L"evRdpConnected";
	case evRdpNotConnected: return L"evRdpNotConnected";
	case evRdpConnectionBroken: return L"evRdpConnectionBroken";
	case evRdpInvalidProtocol: return L"evRdpInvalidProtocol";

	case evLicAcquiredLocally: return L"evLicAcquiredLocally";
	case evLicReleasedLocally: return L"evLicReleasedLocally";
	case evLicLicenseExceeding: return L"evLicExceeding";
	case evLicLicenseExpired: return L"evLicExpired";
	case evLicAcquiredBySrv: return L"evLicAcquiredBySrv";
	case evLicReleasedBySrv: return L"evLicReleasedBySrv";
	case evLicSrvSessionOpened: return L"evLicSrvSessionOpened";
	case evLicSrvSessionClosed: return L"evLicSrvSessionClosed";
	case evLicNoMoreSublicenses: return L"evLicNoMoreSublicenses";
	case evLicSublicReleased: return L"evLicSublicReleased";
	}
	return L"Unknown";
}
#endif

typedef VOID(__cdecl *PNOTIFICATION_CALLBACK)(
	FT_PRINTER_EVENT nNotifyEvent, LPVOID lpData, LPVOID lpContext
	);
typedef PNOTIFICATION_CALLBACK *NOTIFICATION_CALLBACK;