/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Injectable, EventEmitter } from '@angular/core';
import { StorageService } from '@dotgov/core';
var FVFormBuilderService = /** @class */ (function (_super) {
    tslib_1.__extends(FVFormBuilderService, _super);
    function FVFormBuilderService() {
        var _this = _super.call(this) || this;
        _this.onFocus = new EventEmitter();
        _this.onFocusLost = new EventEmitter();
        _this._processBuilderStatusChanged = new EventEmitter();
        return _this;
    }
    Object.defineProperty(FVFormBuilderService.prototype, "processBuilderStatus", {
        get: /**
         * @return {?}
         */
        function () {
            return this._processBuilderStatus;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FVFormBuilderService.prototype, "canRunBuilder", {
        get: /**
         * @return {?}
         */
        function () {
            return this._canRunProcessBuilder;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FVFormBuilderService.prototype, "focus", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.onFocus.emit(value);
            this._activeFocus = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FVFormBuilderService.prototype, "focusLost", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.onFocusLost.emit(value);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FVFormBuilderService.prototype, "processBuilder", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            if (!this._canRunProcessBuilder) {
                return;
            }
            this._processBuilderStatus = value;
            this._processBuilderStatusChanged.emit(value);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FVFormBuilderService.prototype, "_canRunBuilder", {
        set: /**
         * @param {?} userData
         * @return {?}
         */
        function (userData) {
            /** @type {?} */
            var isAdmin = userData && userData.isAdmin;
            this._canRunProcessBuilder = userData ? isAdmin : false;
        },
        enumerable: true,
        configurable: true
    });
    FVFormBuilderService.decorators = [
        { type: Injectable }
    ];
    /** @nocollapse */
    FVFormBuilderService.ctorParameters = function () { return []; };
    return FVFormBuilderService;
}(StorageService));
export { FVFormBuilderService };
if (false) {
    /** @type {?} */
    FVFormBuilderService.prototype.onFocus;
    /** @type {?} */
    FVFormBuilderService.prototype.onFocusLost;
    /** @type {?} */
    FVFormBuilderService.prototype._activeFocus;
    /** @type {?} */
    FVFormBuilderService.prototype._canRunProcessBuilder;
    /** @type {?} */
    FVFormBuilderService.prototype._processBuilderStatus;
    /** @type {?} */
    FVFormBuilderService.prototype._processBuilderStatusChanged;
}

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybUJ1aWxkZXIuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0Bkb3Rnb3YvZm9ybXZpZXdlci8iLCJzb3VyY2VzIjpbImxpYi9zZXJ2aWNlcy9mb3JtQnVpbGRlci5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxZQUFZLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDekQsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLGNBQWMsQ0FBQzs7SUFHSixnREFBYztJQVN0RDtRQUFBLFlBQ0UsaUJBQU8sU0FDUjt3QkFWUyxJQUFJLFlBQVksRUFBTzs0QkFDbkIsSUFBSSxZQUFZLEVBQU87NkNBS0UsSUFBSSxZQUFZLEVBQVc7O0tBSWpFO0lBRUQsc0JBQUksc0RBQW9COzs7O1FBQXhCO1lBQ0UsTUFBTSxDQUFDLElBQUksQ0FBQyxxQkFBcUIsQ0FBQztTQUNuQzs7O09BQUE7SUFFRCxzQkFBSSwrQ0FBYTs7OztRQUFqQjtZQUNFLE1BQU0sQ0FBQyxJQUFJLENBQUMscUJBQXFCLENBQUM7U0FDbkM7OztPQUFBO0lBRUQsc0JBQUksdUNBQUs7Ozs7O1FBQVQsVUFBVSxLQUFLO1lBQ2IsSUFBSSxDQUFDL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