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

const MorphLang = require("./../../../morph/MorphLang");
const TitleItemTokenTypes = require("./TitleItemTokenTypes");

class PersonRelation {
    
    constructor() {
        this.person = null;
        this.coefs = new Hashtable();
    }
    
    get best() {
        let res = TitleItemTokenTypes.UNDEFINED;
        let max = 0;
        for (const v of this.coefs.entries) {
            if (v.value > max) {
                res = v.key;
                max = v.value;
            }
            else if (v.value === max) 
                res = TitleItemTokenTypes.UNDEFINED;
        }
        return res;
    }
    
    toString() {
        let res = new StringBuilder();
        res.append(this.person.toStringEx(true, MorphLang.UNKNOWN, 0)).append(" ").append(String(this.best));
        for (const v of this.coefs.entries) {
            res.append(" ").append(v.value).append("(").append(v.key.toString()).append(")");
        }
        return res.toString();
    }
    
    static _new3529(_arg1) {
        let res = new PersonRelation();
        res.person = _arg1;
        return res;
    }
}


module.exports = PersonRelation