/*
 * SDK Pullenti Lingvo, 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#.NET project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

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

/**
 * Тип значения простого номера
 */
class SingleNumValueType {

    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 SingleNumValueType) 
            return val;
        if(typeof val === 'string' || val instanceof String) {
            val = val.toUpperCase();
            if(SingleNumValueType.mapStringToEnum.containsKey(val))
                return SingleNumValueType.mapStringToEnum.get(val);
            return null;
        }
        if(SingleNumValueType.mapIntToEnum.containsKey(val))
            return SingleNumValueType.mapIntToEnum.get(val);
        let it = new SingleNumValueType(val, val.toString());
        SingleNumValueType.mapIntToEnum.put(val, it);
        SingleNumValueType.mapStringToEnum.put(val.toString(), it);
        return it;
    }
    static isDefined(val) {
        return SingleNumValueType.m_Keys.indexOf(val) >= 0;
    }
    static getValues() {
        return SingleNumValueType.m_Values;
    }
    static static_constructor() {
        SingleNumValueType.mapIntToEnum = new Hashtable();
        SingleNumValueType.mapStringToEnum = new Hashtable();
        SingleNumValueType.DIGIT = new SingleNumValueType(0, "DIGIT");
        SingleNumValueType.mapIntToEnum.put(SingleNumValueType.DIGIT.value(), SingleNumValueType.DIGIT); 
        SingleNumValueType.mapStringToEnum.put(SingleNumValueType.DIGIT.m_str.toUpperCase(), SingleNumValueType.DIGIT); 
        SingleNumValueType.ROMAN = new SingleNumValueType(1, "ROMAN");
        SingleNumValueType.mapIntToEnum.put(SingleNumValueType.ROMAN.value(), SingleNumValueType.ROMAN); 
        SingleNumValueType.mapStringToEnum.put(SingleNumValueType.ROMAN.m_str.toUpperCase(), SingleNumValueType.ROMAN); 
        SingleNumValueType.LETTER = new SingleNumValueType(2, "LETTER");
        SingleNumValueType.mapIntToEnum.put(SingleNumValueType.LETTER.value(), SingleNumValueType.LETTER); 
        SingleNumValueType.mapStringToEnum.put(SingleNumValueType.LETTER.m_str.toUpperCase(), SingleNumValueType.LETTER); 
        SingleNumValueType.m_Values = Array.from(SingleNumValueType.mapIntToEnum.values);
        SingleNumValueType.m_Keys = Array.from(SingleNumValueType.mapIntToEnum.keys);
    }
}


SingleNumValueType.static_constructor();

module.exports = SingleNumValueType