(function() {
  'use strict';

  /**
   * @name         Controllers
   * @memberOf     wallabyTestingApp
   * @desc         Controllers for application.
   */
  angular.module('wallabyTestingApp')
    .controller('MainController', MainController);

  MainController.$inject = ['DataService'];

  /**
   * @name        MainController
   * @memberOf    wallabyTestingApp.Controllers
   * @desc        MainController for application.
   *
   * @ngInject
   *
   * @param       {wallabyTestingApp.Services.DataService}    DataService
   *
   * @constructor
   */
  function MainController(DataService) {
    var main = this;

    // Variables
    main.email    = "";
    main.password = "";
    main.data     = [];


    // Functions
    main.validate = validate;

    /**
     * Dummy validate function to demonstrate tests
     * for controller functions.
     *
     * @note Don't actually use this on real applications :-)
     *
     * @returns {boolean}
     */
    function validate() {
      return (
        main.email.length > 0 &&
        main.password.length > 0 &&
        main.email.indexOf('@') !== -1
      );
    }

    /**
     * Dummy initialize function.
     */
    function initialize() {
      main.data = DataService.getData();
    }

    // Run initialize
    initialize();
  }
})();
