define([
  "dojo/_base/declare",
  "helpers/NodeCache",
  "helpers/RequestWrapper"
], function (declare, NodeCache, RequestWrapper) {

  return declare(null, {

    constructor: function () { },

    init(target, bb) {
      $('#toggleFreezeScene').prop('disabled', false);
    },

    settingBoundingBox: function (target, bb) {
      bb.clear();
      NodeCache.clearAll();
      target.changeState("BoundingBoxDefining");
    },

    makingRequest: function (target) {
      let requestWrapper = new RequestWrapper();
      requestWrapper.request({
        host: $("#host").val(),
        port: $("#port").val(),
        endpoint: $("#endpoint").val(),
        boundingBox: $("#boundingBoxInput").val()
      });
      target.changeState("WaitingForPortrayal");
    },

    toggleFreezingScene: function (target) {
      target.changeState("FreezeScene");
    }

  });

});