/*!
 *
 * carbon-angular v0.0.7 | experimental.service.js
 *
 * Copyright 2014, 2019 IBM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


import { Injectable } from "@angular/core";
var ExperimentalService = /** @class */ (function () {
    function ExperimentalService() {
        /**
         * Map to hold all our experiments
         */
        this.experiments = new Map();
    }
    Object.defineProperty(ExperimentalService.prototype, "isExperimental", {
        /**
         * Gets the state of the v10 experimental mode
         * @deprecated since v3
         */
        get: function () {
            return ExperimentalService.experimentalEnabled;
        },
        /**
         * Sets the v10 experimental mode
         * @deprecated since v3
         */
        set: function (v) {
            ExperimentalService.experimentalEnabled = v;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Adds an experiment if it doesn't exist.
     */
    ExperimentalService.prototype.addExperiment = function (name, options) {
        if (options === void 0) { options = { enabled: false }; }
        if (!this.experiments.has(name)) {
            this.experiments.set(name, options);
        }
    };
    /**
     * Enables an experiment by name
     * @param name name of the experiment to enable
     */
    ExperimentalService.prototype.enableExperiment = function (name) {
        var experiment = this.getExperiment(name);
        experiment.enabled = true;
    };
    /**
     * Disables an experiment by name
     * @param name name of the experiment to disable
     */
    ExperimentalService.prototype.disableExperiment = function (name) {
        var experiment = this.getExperiment(name);
        experiment.enabled = false;
    };
    /**
     * Get the options for an experiment by name
     * @param name name of experiment to get
     */
    ExperimentalService.prototype.getExperiment = function (name) {
        if (!this.experiments.has(name)) {
            this.addExperiment(name);
            return this.getExperiment(name);
        }
        return this.experiments.get(name);
    };
    /**
     * Get an array of tuples representing an experiment and it's options
     */
    ExperimentalService.prototype.getExperiments = function () {
        return Array.from(this.experiments.entries());
    };
    /**
     * Tracks if the v10 experimental mode is enabled
     * @deprecated since v3
     */
    ExperimentalService.experimentalEnabled = true;
    ExperimentalService.decorators = [
        { type: Injectable },
    ];
    return ExperimentalService;
}());
export { ExperimentalService };
//# sourceMappingURL=experimental.service.js.map