/*
 * 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 update to apply.
class UpdateCommand {

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


UpdateCommand.static_constructor();

module.exports = UpdateCommand