/*
 * 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");

// The kind of compression used for an entry in an archive
class CompressionMethod {

    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 CompressionMethod) 
            return val;
        if(typeof val === 'string' || val instanceof String) {
            val = val.toUpperCase();
            if(CompressionMethod.mapStringToEnum.containsKey(val))
                return CompressionMethod.mapStringToEnum.get(val);
            return null;
        }
        if(CompressionMethod.mapIntToEnum.containsKey(val))
            return CompressionMethod.mapIntToEnum.get(val);
        let it = new CompressionMethod(val, val.toString());
        CompressionMethod.mapIntToEnum.put(val, it);
        CompressionMethod.mapStringToEnum.put(val.toString(), it);
        return it;
    }
    static isDefined(val) {
        return CompressionMethod.m_Keys.indexOf(val) >= 0;
    }
    static getValues() {
        return CompressionMethod.m_Values;
    }
    static static_constructor() {
        CompressionMethod.mapIntToEnum = new Hashtable();
        CompressionMethod.mapStringToEnum = new Hashtable();
        CompressionMethod.STORED = new CompressionMethod(0, "STORED");
        CompressionMethod.mapIntToEnum.put(CompressionMethod.STORED.value(), CompressionMethod.STORED); 
        CompressionMethod.mapStringToEnum.put(CompressionMethod.STORED.m_str.toUpperCase(), CompressionMethod.STORED); 
        CompressionMethod.DEFLATED = new CompressionMethod(8, "DEFLATED");
        CompressionMethod.mapIntToEnum.put(CompressionMethod.DEFLATED.value(), CompressionMethod.DEFLATED); 
        CompressionMethod.mapStringToEnum.put(CompressionMethod.DEFLATED.m_str.toUpperCase(), CompressionMethod.DEFLATED); 
        CompressionMethod.DEFLATE64 = new CompressionMethod(9, "DEFLATE64");
        CompressionMethod.mapIntToEnum.put(CompressionMethod.DEFLATE64.value(), CompressionMethod.DEFLATE64); 
        CompressionMethod.mapStringToEnum.put(CompressionMethod.DEFLATE64.m_str.toUpperCase(), CompressionMethod.DEFLATE64); 
        CompressionMethod.BZIP2 = new CompressionMethod(11, "BZIP2");
        CompressionMethod.mapIntToEnum.put(CompressionMethod.BZIP2.value(), CompressionMethod.BZIP2); 
        CompressionMethod.mapStringToEnum.put(CompressionMethod.BZIP2.m_str.toUpperCase(), CompressionMethod.BZIP2); 
        CompressionMethod.WINZIPAES = new CompressionMethod(99, "WINZIPAES");
        CompressionMethod.mapIntToEnum.put(CompressionMethod.WINZIPAES.value(), CompressionMethod.WINZIPAES); 
        CompressionMethod.mapStringToEnum.put(CompressionMethod.WINZIPAES.m_str.toUpperCase(), CompressionMethod.WINZIPAES); 
        CompressionMethod.m_Values = Array.from(CompressionMethod.mapIntToEnum.values);
        CompressionMethod.m_Keys = Array.from(CompressionMethod.mapIntToEnum.keys);
    }
}


CompressionMethod.static_constructor();

module.exports = CompressionMethod