(function () {
    'use strict';

    angular
        .module('setoresApp')
        .directive('configuracoesAlarmes', configuracoesAlarmes);

    configuracoesAlarmes.$inject = ['__env'];

    /* @ngInject */
    function configuracoesAlarmes(__env) {
        let directive = {
            link: link,
            restrict: 'A',
            replace: false,
            scope: false
        };

        return directive;

        function link(scope, element, attrs) {
            angular.extend(scope.vm, {
                toggleCheckAll: toggleCheckAll,
                toggleCheckItem: toggleCheckItem
            });

            function toggleCheckAll(list, value) {
                list.forEach((item) => item.Selected = value);
            }

            function toggleCheckItem(list, checkboxAll) {
                let oneEmpty = list.some((item) => {
                    if (!item.Selected) {
                        return true;
                    }
                });

                console.log(oneEmpty);
            }

        }
    }

})();

