"use strict";
/**
 * Default Feature Flag
 *
 *  Copyright (C) 2010-2019 R-T Specialty, LLC.
 *
 *  This file is part of the Liza Data Collection Framework
 *
 *  Liza is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultFeatureFlag = void 0;
/**
 * Default feature flag
 */
var DefaultFeatureFlag = /** @class */ (function () {
    /**
     * Initialize FeatureFlag
     */
    function DefaultFeatureFlag(_defaults) {
        this._defaults = _defaults;
    }
    /**
     * No connections or variables to resolve
     */
    DefaultFeatureFlag.prototype.close = function () { };
    /**
     * Look up a feature flag by key
     *
     * @param key - the key to lookup
     *
     * @return whether or not this feature flag is enabled
     */
    DefaultFeatureFlag.prototype.isEnabled = function (key) {
        var value = this._defaults[key];
        if (value === undefined) {
            return Promise.reject('Feature flag "' + key + '" is undefined');
        }
        return Promise.resolve(!!value);
    };
    return DefaultFeatureFlag;
}());
exports.DefaultFeatureFlag = DefaultFeatureFlag;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRGVmYXVsdEZlYXR1cmVGbGFnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiRGVmYXVsdEZlYXR1cmVGbGFnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQW1CRzs7O0FBSUg7O0dBRUc7QUFDSDtJQUNFOztPQUVHO0lBQ0gsNEJBQTZCLFNBQWdDO1FBQWhDLGNBQVMsR0FBVCxTQUFTLENBQXVCO0lBQUcsQ0FBQztJQUVqRTs7T0FFRztJQUNILGtDQUFLLEdBQUwsY0FBZSxDQUFDO0lBRWhCOzs7Ozs7T0FNRztJQUNILHNDQUFTLEdBQVQsVUFBVSxHQUFXO1FBQ25CLElBQU0sS0FBSyxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLENBQUM7UUFFbEMsSUFBSSxLQUFLLEtBQUssU0FBUyxFQUFFO1lBQ3ZCLE9BQU8sT0FBTyxDQUFDLE1BQU0sQ0FBQyxnQkFBZ0IsR0FBRyxHQUFHLEdBQUcsZ0JBQWdCLENBQUMsQ0FBQztTQUNsRTtRQUVELE9BQU8sT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUM7SUFDbEMsQ0FBQztJQUNILHlCQUFDO0FBQUQsQ0FBQyxBQTNCRCxJQTJCQztBQTNCWSxnREFBa0IifQ==