var fs = require('fs');

fcf.module({
  name: "fcf:NServer/NControllers/Include.js",
  dependencies: ["fcf:NServer/NServer.js", "fcf:NServer/NControllers/Controller.js", "fcf:NTools/babel.js", "fcf:NTools/fileBuilder.js"],
  module: function(NServer, Controller, babel, fileBuilder) {
    fcf.prepareObject(fcf, "NServer.NControllers");

    var resultContext = false;
    var resultContextES5 = false;

    NServer.NControllers.Include = class Include extends Controller {
      action(a_request) {
        a_request.setHeader("Content-Type", "application/javascript");
        let filePath = undefined;
        if (fcf.getContext().needBabel){
          filePath = fileBuilder.getGroupFilePathES5("include");
        } else {
          filePath = fileBuilder.getGroupFilePath("include");
        }
        a_request.sendFile(filePath);
      }

    }

    return NServer.NControllers.Include;
  }
});
