#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <windows.h>
#include "pretrade.h"

 BOOL WINAPI UserConnected(char* UserId, char* ErrorMsg)
{
  char buffer[1024];
#ifdef _MSC_VER
  sprintf_s(buffer, "Allow user %s to connect?", UserId);
#else
  sprintf(buffer, "Allow user %s to connect?", UserId);
#endif
  return MessageBox(0, buffer, "Order Validation",
	  MB_ICONQUESTION	| MB_YESNO | MB_SETFOREGROUND) == IDYES;
}

void WINAPI UserDisconnected(char* UserId)
{
  // TODO
}

BOOL WINAPI ValidateOrderEx(char * UserId, char *TransName, char* Params, char* JsonParams, char *ErrorMsg)
{
    char buffer[1024];
#ifdef _MSC_VER
    sprintf_s(buffer, "Allow user %s to execute %s?", UserId, TransName);
    sprintf_s(ErrorMsg, PT_MAX_ERROR_LENGTH, "Demo error for user %s", UserId);
#else
    sprintf(buffer, "Allow user %s to execute %s?", UserId, TransName);
    sprintf(ErrorMsg, "Demo error for user %s", UserId);
#endif
    return MessageBox(0, buffer, "Order Validation",
	  MB_ICONQUESTION	| MB_YESNO | MB_SETFOREGROUND) == IDYES;
}
