/**
 * @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';
/**
 * \@Author [GrigoreMe](https://github.com/grigoreme)
 */
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
    });
    /**
     * @param {?} event
     * @return {?}
     */
    FVFormBuilderService.prototype.focus = /**
     * @param {?} event
     * @return {?}
     */
    function (event) {
        this.onFocus.emit(event);
    };
    /**
     * @param {?} event
     * @return {?}
     */
    FVFormBuilderService.prototype.loseFocus = /**
     * @param {?} event
     * @return {?}
     */
    function (event) {
        this.onFocusLost.emit(event);
    };
    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._canRunProcessBuilder;
    /** @type {?} */
    FVFormBuilderService.prototype._processBuilderStatus;
    /** @type {?} */
    FVFormBuilderService.prototype._processBuilderStatusChanged;
}

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