'use strict';

define([
  'angular',
  'widgets/mapapp/dashboard/services/ReportIndicatorFactory',
  'widgets/mapapp/dashboard/services/IndicatorParamsFactory',
  'widgets/mapapp/dashboard/directives/dashboardwidget',
  'widgets/mapapp/dashboard/directives/anIndicator',
  'widgets/mapapp/dashboard/controllers/OverviewController',
], function(
  angular,
  ReportIndicatorFactory,
  IndicatorParamsFactory,
  dashboardwidget,
  anIndicator,
  OverviewController
) {
  // Module
  var gc_dashboard = angular.module('gc_dashboard', ['pascalprecht.translate']);

  //        gc_dashboard.factory('$exceptionHandler', function() {
  //            return function(exception, cause) {
  //                exception.message += 'gc_dashboard (caused by "' + cause + '")';
  //                console.log(exception.message);
  //            };
  //        });

  //        gc_dashboard.config(function($datepickerProvider) {
  //            angular.extend($datepickerProvider.defaults, {
  //              dateFormat: 'dd/MM/yyyy',
  //              startWeek: 1
  //            });
  //          });

  // Services
  gc_dashboard.factory('ReportIndicatorFactory', ReportIndicatorFactory);
  gc_dashboard.factory('IndicatorParamsFactory', IndicatorParamsFactory);

  //Controlleur de la popup de visualisation du rapport
  gc_dashboard.controller('OverviewController', OverviewController);

  //Directive d'un indicateur
  gc_dashboard.directive('anIndicator', anIndicator);

  //Directive conteneur principal du widget
  gc_dashboard.directive('dashboardwidget', dashboardwidget);

  return gc_dashboard;
});
