#include <random>

#include <config.h>
#include <Nice/App/Application.h>
#include <Nice/App/ConfigClient.h>

#include <Basda/Mocca/WheelServiceWorkerInterface.h>
#include <Basda/Mocca/Exception.h>
#include <Basda/Mocca/Constant.h>
#include <boost/assign/list_inserter.hpp>

#include "wheelNiceApp.hpp"

//using namespace std;
using namespace Ice;
using namespace boost::assign;




int main(int /*argc*/, char* /*argv[]*/)
{
  static std::random_device rdev{};
  static std::default_random_engine e{rdev()};
  static std::uniform_int_distribution<int> d{1,8};
  int namedPos = d(e);

  int argc = 3;
  const int NUM_STRINGS = 4;
  char* argv[NUM_STRINGS] = {"main\0", 
			     "--DATA.WHEEL.CONFIG:Endpoint=[NAME=WHEEL_CTRL, PORT=10211]\0", 
			     "--LOGGER.LEVEL:LogLevel=INFO\0","0\0"};
  std::string svcPath = "DATA.WHEEL.SCI_WHEEL1.SVC";


  wheelNiceApp app(svcPath);
 
  app.callbackOnInterrupt();
  I_LOG(namedPos);
  while (namedPos == (app.getPosition()))
    {
      I_LOG(namedPos);
      namedPos = d(e);
    }

  app.init(argc, argv);
  app.runNamedPos(namedPos);  
  
  // while (true)
  //   {
  //   }
  return 0;
}
