/*
 * 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 Utils = require("./../../unisharp/Utils");
const StringBuilder = require("./../../unisharp/StringBuilder");

const ReferentsEqualType = require("./../core/ReferentsEqualType");
const ReferentClass = require("./../metadata/ReferentClass");
const Referent = require("./../Referent");
const MiscHelper = require("./../core/MiscHelper");
const InstrumentArtefactMeta = require("./internal/InstrumentArtefactMeta");

/**
 * Для судебных решений формализованная резолюция (пока).
 */
class InstrumentArtefactReferent extends Referent {
    
    constructor() {
        super(InstrumentArtefactReferent.OBJ_TYPENAME);
        this.instanceOf = InstrumentArtefactMeta.GLOBAL_META;
    }
    
    get typ() {
        return this.getStringValue(InstrumentArtefactReferent.ATTR_TYPE);
    }
    set typ(_value) {
        this.addSlot(InstrumentArtefactReferent.ATTR_TYPE, (_value === null ? null : _value.toUpperCase()), true, 0);
        return _value;
    }
    
    get value() {
        return this.getSlotValue(InstrumentArtefactReferent.ATTR_VALUE);
    }
    set value(_value) {
        this.addSlot(InstrumentArtefactReferent.ATTR_VALUE, _value, false, 0);
        return _value;
    }
    
    toStringEx(shortVariant, lang, lev = 0) {
        let res = new StringBuilder();
        res.append(MiscHelper.convertFirstCharUpperAndOtherLower(Utils.notNull(this.typ, "?")));
        let val = this.value;
        if (val !== null) 
            res.append(": ").append(val);
        if (!shortVariant && (lev < 30)) {
            let re = Utils.as(this.getSlotValue(InstrumentArtefactReferent.ATTR_REF), Referent);
            if (re !== null) 
                res.append(" (").append(re.toStringEx(shortVariant, lang, lev + 1)).append(")");
        }
        return res.toString();
    }
    
    canBeEquals(obj, _typ = ReferentsEqualType.WITHINONETEXT) {
        let p = Utils.as(obj, InstrumentArtefactReferent);
        if (p === null) 
            return false;
        if (this.typ !== p.typ) 
            return false;
        if (this.value !== p.value) 
            return false;
        return true;
    }
    
    static _new2181(_arg1) {
        let res = new InstrumentArtefactReferent();
        res.typ = _arg1;
        return res;
    }
    
    static static_constructor() {
        InstrumentArtefactReferent.OBJ_TYPENAME = "INSTRARTEFACT";
        InstrumentArtefactReferent.ATTR_TYPE = "TYPE";
        InstrumentArtefactReferent.ATTR_VALUE = "VALUE";
        InstrumentArtefactReferent.ATTR_REF = "REF";
    }
}


InstrumentArtefactReferent.static_constructor();

module.exports = InstrumentArtefactReferent