'use strict';
define(function() {
  var encodingChoice = function() {
    return {
      templateUrl: 'js/XG/widgets/utilities/encoding/views/encodingChoice.html',
      restrict: 'AE',
      scope: {
        fileEncoding: '=',
        required: '=?required'
      },
      link: function(scope) {
        const none = '-----';
        scope.fileEncodings
          = [none, 'UTF-8', 'ISO-8859-15', 'Windows-1252', 'ISO-8859-1', 'UTF-16'];
        scope.fileEncoding = none;

        scope.$on('initializeDirective', () => {
          scope.fileEncoding = none;
        });
      }
    };
  };
  return encodingChoice;
});