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

package com.pullenti.ner.resume;

/**
 * Элемент резюме
 */
public class ResumeItemReferent extends com.pullenti.ner.Referent {

    public ResumeItemReferent() {
        super(OBJ_TYPENAME);
        setInstanceOf(MetaResume.GLOBALMETA);
    }

    /**
     * Имя типа сущности TypeName ("RESUME")
     */
    public static final String OBJ_TYPENAME = "RESUME";

    /**
     * Имя атрибута - тип элемента (см. ResumeItemType)
     */
    public static final String ATTR_TYPE = "TYPE";

    /**
     * Имя атрибута - значение
     */
    public static final String ATTR_VALUE = "VALUE";

    /**
     * Имя атрибута - ссылка на сущность
     */
    public static final String ATTR_REF = "REF";

    /**
     * Имя атрибуты - ссылка на временной диапазон (для времени работы)
     */
    public static final String ATTR_DATERANGE = "DATERANGE";

    /**
     * Имя атрибута - признак снятия резюме
     */
    public static final String ATTR_EXPIRED = "EXPIRED";

    /**
     * Имя атрибута - разная мелочь, если есть
     */
    public static final String ATTR_MISC = "MISC";

    public ResumeItemType getTyp() {
        String str = this.getStringValue(ATTR_TYPE);
        if (str == null) 
            return ResumeItemType.UNDEFINED;
        try {
            return (ResumeItemType)ResumeItemType.of(str);
        } catch (Exception ex3528) {
        }
        return ResumeItemType.UNDEFINED;
    }

    public ResumeItemType setTyp(ResumeItemType _value) {
        this.addSlot(ATTR_TYPE, _value.toString().toLowerCase(), true, 0);
        return _value;
    }


    public String getValue() {
        return this.getStringValue(ATTR_VALUE);
    }

    public String setValue(String _value) {
        this.addSlot(ATTR_VALUE, _value, true, 0);
        return _value;
    }


    public String getMisc() {
        return this.getStringValue(ATTR_MISC);
    }

    public String setMisc(String _value) {
        this.addSlot(ATTR_MISC, _value, true, 0);
        return _value;
    }


    public com.pullenti.ner.Referent getRef() {
        return (com.pullenti.ner.Referent)com.pullenti.unisharp.Utils.cast(this.getSlotValue(ATTR_REF), com.pullenti.ner.Referent.class);
    }

    public com.pullenti.ner.Referent setRef(com.pullenti.ner.Referent _value) {
        this.addSlot(ATTR_REF, _value, true, 0);
        return _value;
    }


    public com.pullenti.ner.Referent getDateRange() {
        return (com.pullenti.ner.Referent)com.pullenti.unisharp.Utils.cast(this.getSlotValue(ATTR_DATERANGE), com.pullenti.ner.Referent.class);
    }

    public com.pullenti.ner.Referent setDateRange(com.pullenti.ner.Referent _value) {
        this.addSlot(ATTR_DATERANGE, _value, true, 0);
        return _value;
    }


    public boolean getExpired() {
        return com.pullenti.unisharp.Utils.stringsEq(this.getStringValue(ATTR_EXPIRED), "true");
    }

    public boolean setExpired(boolean _value) {
        this.addSlot(ATTR_EXPIRED, (_value ? "true" : null), true, 0);
        return _value;
    }


    @Override
    public String toStringEx(boolean shortVariant, com.pullenti.morph.MorphLang lang, int lev) {
        StringBuilder tmp = new StringBuilder();
        tmp.append(MetaResume.TYPES.convertInnerValueToOuterValue(this.getStringValue(ATTR_TYPE), null)).append(": ");
        if (getRef() != null) {
            com.pullenti.ner.Referent dt = getDateRange();
            if (dt != null) 
                tmp.append(dt.toStringEx(true, null, 0)).append(": ");
            tmp.append(this.getRef().toStringEx(shortVariant, lang, lev + 1));
            if (getValue() != null) 
                tmp.append(" (").append(this.getValue()).append(")");
        }
        else if (getValue() != null) 
            tmp.append(this.getValue());
        if (getExpired()) 
            tmp.append(" (не актуально)");
        if (getMisc() != null) 
            tmp.append(" (").append(this.getMisc()).append(")");
        return tmp.toString();
    }

    @Override
    public com.pullenti.ner.core.IntOntologyItem createOntologyItem() {
        com.pullenti.ner.core.IntOntologyItem oi = new com.pullenti.ner.core.IntOntologyItem(this);
        oi.termins.add(new com.pullenti.ner.core.Termin(getValue(), null, false));
        return oi;
    }

    public static ResumeItemReferent _new3517(ResumeItemType _arg1, com.pullenti.ner.Referent _arg2) {
        ResumeItemReferent res = new ResumeItemReferent();
        res.setTyp(_arg1);
        res.setRef(_arg2);
        return res;
    }

    public static ResumeItemReferent _new3526(ResumeItemType _arg1) {
        ResumeItemReferent res = new ResumeItemReferent();
        res.setTyp(_arg1);
        return res;
    }
}
