export function WzStepDirective() {
    const directive = {
        restrict: 'EA',
        replace: true,
        transclude: true,
        scope: {
            wzTitle: '@',
            wzHeadingTitle: '@',
            canenter: '=',
            canexit: '=',
            disabled: '@?wzDisabled',
            description: '@',
            wzData: '=',
            wzOrder: '@?',
            clickable: '='
        },
        require: '^wizard',
        templateUrl: function (element, attributes) {
            return attributes.template || "app/modules/wizard/step.html";
        },
        link: linkFunc
    };

    return directive;

    function linkFunc($scope, $element, $attrs, wizard) {
        $attrs.$observe('wzTitle', function () {
            $scope.title = $scope.wzTitle;
        });
        $scope.title = $scope.wzTitle;
        wizard.addStep($scope);
        $scope.$on('$destroy', function () {
            wizard.removeStep($scope);
        });
    }
}