/*
 * 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
 */

package com.pullenti.unitext.internal.uni;

// Уровень стиля нумерации
public class UniTextGenNumLevel {

    public UniTextGenNumType type = UniTextGenNumType.BULLET;

    public String format;

    public int start = 1;

    public int current = 0;

    public com.pullenti.unitext.UnitextStyle style;

    public UniTextGenNumLevel clone() {
        UniTextGenNumLevel res = new UniTextGenNumLevel();
        res.type = type;
        res.format = format;
        res.start = start;
        res.current = current;
        if (style != null) 
            res.style = style.clone(false);
        return res;
    }

    @Override
    public String toString() {
        return (type.toString() + " '" + format + "' from " + start);
    }

    public String getValue(int cur) {
        if (type == UniTextGenNumType.BULLET) 
            return format;
        if (type == UniTextGenNumType.DECIMAL) 
            return ((Integer)cur).toString();
        if (type == UniTextGenNumType.LOWERLETTER) 
            return ((String.valueOf((char)(((((int)'a') + cur) - 1)))));
        if (type == UniTextGenNumType.LOWERCYRLETTER) {
            if (cur >= 10) 
                cur++;
            return ((String.valueOf((char)(((((int)'а') + cur) - 1)))));
        }
        if (type == UniTextGenNumType.UPPERCYRLETTER) {
            if (cur >= 10) 
                cur++;
            return ((String.valueOf((char)(((((int)'А') + cur) - 1)))));
        }
        if (type == UniTextGenNumType.UPPERLETTER) 
            return ((String.valueOf((char)(((((int)'A') + cur) - 1)))));
        if (type == UniTextGenNumType.LOWERROMAN) {
            if (cur > 0 && ((cur - 1) < UnitextHelper.m_Romans.length)) 
                return UnitextHelper.m_Romans[cur - 1].toLowerCase();
        }
        if (type == UniTextGenNumType.UPPERROMAN) {
            if (cur > 0 && ((cur - 1) < UnitextHelper.m_Romans.length)) 
                return UnitextHelper.m_Romans[cur - 1];
        }
        return ((Integer)cur).toString();
    }

    public static UniTextGenNumLevel _new114(UniTextGenNumType _arg1) {
        UniTextGenNumLevel res = new UniTextGenNumLevel();
        res.type = _arg1;
        return res;
    }

    public static UniTextGenNumLevel _new132(UniTextGenNumType _arg1, String _arg2) {
        UniTextGenNumLevel res = new UniTextGenNumLevel();
        res.type = _arg1;
        res.format = _arg2;
        return res;
    }
    public UniTextGenNumLevel() {
    }
}
