"use strict";
var LogFilter = (function () {
    function LogFilter($devicePlatformsConstants, $injector, $loggingLevels) {
        this.$devicePlatformsConstants = $devicePlatformsConstants;
        this.$injector = $injector;
        this.$loggingLevels = $loggingLevels;
        this._loggingLevel = this.$loggingLevels.info;
    }
    Object.defineProperty(LogFilter.prototype, "loggingLevel", {
        get: function () {
            return this._loggingLevel;
        },
        set: function (logLevel) {
            if (this.verifyLogLevel(logLevel)) {
                this._loggingLevel = logLevel;
            }
        },
        enumerable: true,
        configurable: true
    });
    LogFilter.prototype.filterData = function (platform, data, logLevel) {
        var deviceLogFilter = this.getDeviceLogFilterInstance(platform);
        if (deviceLogFilter) {
            return deviceLogFilter.filterData(data, logLevel || this.loggingLevel);
        }
        return data;
    };
    LogFilter.prototype.getDeviceLogFilterInstance = function (platform) {
        if (platform) {
            if (platform.toLowerCase() === this.$devicePlatformsConstants.iOS.toLowerCase()) {
                return this.$injector.resolve("iOSLogFilter");
            }
            else if (platform.toLowerCase() === this.$devicePlatformsConstants.Android.toLowerCase()) {
                return this.$injector.resolve("androidLogFilter");
            }
        }
        return null;
    };
    LogFilter.prototype.verifyLogLevel = function (logLevel) {
        var upperCaseLogLevel = (logLevel || '').toUpperCase();
        return upperCaseLogLevel === this.$loggingLevels.info.toUpperCase() || upperCaseLogLevel === this.$loggingLevels.full.toUpperCase();
    };
    return LogFilter;
})();
exports.LogFilter = LogFilter;
$injector.register("logFilter", LogFilter);
