text: "use strict";
  var builder = require("botbuilder");
  var botbuilder_azure = require("botbuilder-azure");
  
  var useEmulator = (process.env.NODE_ENV == 'development');
  
  //=========================================================
  // Bot Setup
  //=========================================================
  
  // Create chat bot
  var connector = useEmulator ? new builder.ChatConnector() : new botbuilder_azure.BotServiceConnector({
      appId: process.env['MicrosoftAppId'],
      appPassword: process.env['MicrosoftAppPassword'],
      stateEndpoint: process.env['BotStateEndpoint'],
      openIdMetadata: process.env['BotOpenIdMetadata']
  });
  
  var bot = new builder.UniversalBot(connector, [
      function (session) {
          builder.Prompts.text(session, "Hello... What's your name?");
      },
  
      function (session, results) {
          session.userData.name = results.response;
          builder.Prompts.number(session, "Hi " + results.response + ", How many years have you been coding?");
      },
  
      function (session, results) {
          session.userData.coding = results.response;
          builder.Prompts.choice(session, "What language do you code Node using?", ["JavaScript", "CoffeeScript", "TypeScript"]);
      },
  
      function (session, results) {
          session.userData.language = results.response.entity;
          session.send("Got it... " + session.userData.name +
              " you've been programming for " + session.userData.coding +
              " years and use " + session.userData.language + ".");
      }
  
  ]);
  
  // Setup Restify Server if needed
  if (useEmulator) {
      var restify = require('restify');
      var server = restify.createServer();
      server.listen(3978, function () {
          console.log('test bot endpoint at http://localhost:3978/api/messages');
      });
      server.post('/api/messages', connector.listen());
  } else {
      module.exports = { default: connector.listen() }
  }
  