/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

const Hashtable = require("./../../../unisharp/Hashtable");

class FormattingLevel {

    constructor(val, str) {
        this.m_val = val;
        this.m_str = str;
    }
    toString() {
        return this.m_str;
    }
    value() {
        return this.m_val;
    }
    static of(val) {
        if(val instanceof FormattingLevel) 
            return val;
        if(typeof val === 'string' || val instanceof String) {
            val = val.toUpperCase();
            if(FormattingLevel.mapStringToEnum.containsKey(val))
                return FormattingLevel.mapStringToEnum.get(val);
            return null;
        }
        if(FormattingLevel.mapIntToEnum.containsKey(val))
            return FormattingLevel.mapIntToEnum.get(val);
        let it = new FormattingLevel(val, val.toString());
        FormattingLevel.mapIntToEnum.put(val, it);
        FormattingLevel.mapStringToEnum.put(val.toString(), it);
        return it;
    }
    static isDefined(val) {
        return FormattingLevel.m_Keys.indexOf(val) >= 0;
    }
    static getValues() {
        return FormattingLevel.m_Values;
    }
    static static_constructor() {
        FormattingLevel.mapIntToEnum = new Hashtable();
        FormattingLevel.mapStringToEnum = new Hashtable();
        FormattingLevel.CHARACTER = new FormattingLevel(0, "CHARACTER");
        FormattingLevel.mapIntToEnum.put(FormattingLevel.CHARACTER.value(), FormattingLevel.CHARACTER); 
        FormattingLevel.mapStringToEnum.put(FormattingLevel.CHARACTER.m_str.toUpperCase(), FormattingLevel.CHARACTER); 
        FormattingLevel.CHARACTERSTYLE = new FormattingLevel(1, "CHARACTERSTYLE");
        FormattingLevel.mapIntToEnum.put(FormattingLevel.CHARACTERSTYLE.value(), FormattingLevel.CHARACTERSTYLE); 
        FormattingLevel.mapStringToEnum.put(FormattingLevel.CHARACTERSTYLE.m_str.toUpperCase(), FormattingLevel.CHARACTERSTYLE); 
        FormattingLevel.PARAGRAPH = new FormattingLevel(2, "PARAGRAPH");
        FormattingLevel.mapIntToEnum.put(FormattingLevel.PARAGRAPH.value(), FormattingLevel.PARAGRAPH); 
        FormattingLevel.mapStringToEnum.put(FormattingLevel.PARAGRAPH.m_str.toUpperCase(), FormattingLevel.PARAGRAPH); 
        FormattingLevel.PARAGRAPHSTYLE = new FormattingLevel(3, "PARAGRAPHSTYLE");
        FormattingLevel.mapIntToEnum.put(FormattingLevel.PARAGRAPHSTYLE.value(), FormattingLevel.PARAGRAPHSTYLE); 
        FormattingLevel.mapStringToEnum.put(FormattingLevel.PARAGRAPHSTYLE.m_str.toUpperCase(), FormattingLevel.PARAGRAPHSTYLE); 
        FormattingLevel.PART = new FormattingLevel(4, "PART");
        FormattingLevel.mapIntToEnum.put(FormattingLevel.PART.value(), FormattingLevel.PART); 
        FormattingLevel.mapStringToEnum.put(FormattingLevel.PART.m_str.toUpperCase(), FormattingLevel.PART); 
        FormattingLevel.GLOBAL = new FormattingLevel(5, "GLOBAL");
        FormattingLevel.mapIntToEnum.put(FormattingLevel.GLOBAL.value(), FormattingLevel.GLOBAL); 
        FormattingLevel.mapStringToEnum.put(FormattingLevel.GLOBAL.m_str.toUpperCase(), FormattingLevel.GLOBAL); 
        FormattingLevel.ALL = new FormattingLevel(6, "ALL");
        FormattingLevel.mapIntToEnum.put(FormattingLevel.ALL.value(), FormattingLevel.ALL); 
        FormattingLevel.mapStringToEnum.put(FormattingLevel.ALL.m_str.toUpperCase(), FormattingLevel.ALL); 
        FormattingLevel.m_Values = Array.from(FormattingLevel.mapIntToEnum.values);
        FormattingLevel.m_Keys = Array.from(FormattingLevel.mapIntToEnum.keys);
    }
}


FormattingLevel.static_constructor();

module.exports = FormattingLevel