"use strict";
// *****************************************************************************
// Copyright (C) 2019 Ericsson and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
// *****************************************************************************
Object.defineProperty(exports, "__esModule", { value: true });
exports.Severity = void 0;
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
const nls_1 = require("./nls");
var Severity;
(function (Severity) {
    Severity[Severity["Ignore"] = 0] = "Ignore";
    Severity[Severity["Error"] = 1] = "Error";
    Severity[Severity["Warning"] = 2] = "Warning";
    Severity[Severity["Info"] = 3] = "Info";
    Severity[Severity["Log"] = 4] = "Log";
})(Severity = exports.Severity || (exports.Severity = {}));
const error = 'Errors';
const warning = 'Warnings';
const info = 'Info';
const log = 'Log';
const ignore = 'All';
(function (Severity) {
    function fromValue(value) {
        value = value && value.toLowerCase();
        if (!value) {
            return Severity.Ignore;
        }
        if (['error', 'errors'].indexOf(value) !== -1) {
            return Severity.Error;
        }
        if (['warn', 'warning', 'warnings'].indexOf(value) !== -1) {
            return Severity.Warning;
        }
        if (value === 'info') {
            return Severity.Info;
        }
        if (value === 'log') {
            return Severity.Log;
        }
        return Severity.Ignore;
    }
    Severity.fromValue = fromValue;
    function toDiagnosticSeverity(value) {
        switch (value) {
            case Severity.Ignore:
                return vscode_languageserver_protocol_1.DiagnosticSeverity.Hint;
            case Severity.Info:
                return vscode_languageserver_protocol_1.DiagnosticSeverity.Information;
            case Severity.Log:
                return vscode_languageserver_protocol_1.DiagnosticSeverity.Information;
            case Severity.Warning:
                return vscode_languageserver_protocol_1.DiagnosticSeverity.Warning;
            case Severity.Error:
                return vscode_languageserver_protocol_1.DiagnosticSeverity.Error;
            default:
                return vscode_languageserver_protocol_1.DiagnosticSeverity.Error;
        }
    }
    Severity.toDiagnosticSeverity = toDiagnosticSeverity;
    function toString(severity) {
        switch (severity) {
            case Severity.Error:
                return error;
            case Severity.Warning:
                return warning;
            case Severity.Info:
                return info;
            case Severity.Log:
                return log;
            default:
                return ignore;
        }
    }
    Severity.toString = toString;
    function toLocaleString(severity) {
        if (severity === Severity.Error || severity === error) {
            return nls_1.nls.localize('theia/core/severity/errors', 'Errors');
        }
        else if (severity === Severity.Warning || severity === warning) {
            return nls_1.nls.localize('theia/core/severity/warnings', 'Warnings');
        }
        else if (severity === Severity.Info || severity === info) {
            return nls_1.nls.localizeByDefault('Info');
        }
        else if (severity === Severity.Log || severity === log) {
            return nls_1.nls.localize('theia/core/severity/log', 'Log');
        }
        else {
            return nls_1.nls.localize('theia/core/severity/all', 'All');
        }
    }
    Severity.toLocaleString = toLocaleString;
    function toArray() {
        return [ignore, error, warning, info, log];
    }
    Severity.toArray = toArray;
})(Severity = exports.Severity || (exports.Severity = {}));
//# sourceMappingURL=severity.js.map