fcf.module({
  name: "fcfManagement:templates/pages/access/tabs/users.hooks.js",
  dependencies: [],
  module: function(){
    return {
      //
      // void hookBeforeBuild(a_taskInfo)
      // The hook is executed before assembling the template arguments
      //
      // hookBeforeBuild: function(a_taskInfo) {
      // },

      //
      // void hookAfterBuild(a_taskInfo)
      // The hook is executed after assembling the template arguments
      //
      // hookAfterBuild: function(a_taskInfo) {
      // },

      //
      // Object of hooks for programmatically populated arguments
      //
      hooksProgrammableArgument: {
        userProjection: (a_taskInfo)=>{
          return fcf.application.getConfiguration().userProjectionName;
        },
        userFieldsReadMode: (a_taskInfo)=>{
          let proj = fcf.application.getProjections().get(fcf.application.getConfiguration().userProjectionName);
          let fields = [];
          fcf.each(proj.fields, (k, v)=>{
            if (v.alias !== "password")
              fields.push(v.alias);
          });
          return fields;
        },
        userFieldsEditMode: (a_taskInfo)=>{
          let proj = fcf.application.getProjections().get(fcf.application.getConfiguration().userProjectionName);
          let fields = [];
          let hideFields = fcf.map(["id", "time_creation", "last_login_attempt", "number_login_attempts"], (k,v)=>{return [v,1]});
          fcf.each(proj.fields, (k, v)=>{
            if (!(v.alias in hideFields))
              fields.push(v.alias);
          });
          return fields;
        }
      },
    };
  }
});
