package org.jabref.logic.formatter.casechanger;

import org.jabref.logic.formatter.Formatter;
import org.jabref.logic.l10n.Localization;

import org.jspecify.annotations.NonNull;

public class LowerCaseFormatter extends Formatter {

    @Override
    public String getName() {
        return Localization.lang("lower case");
    }

    @Override
    public String getKey() {
        return "lower_case";
    }

    /// Converts all characters of the string to lower case, but does not change words starting with "{"
    @Override
    public String format(@NonNull String input) {
        Title title = new Title(input);

        title.getWords().forEach(Word::toLowerCase);

        return title.toString();
    }

    @Override
    public String getDescription() {
        return Localization.lang("changes all letters to lower case.");
    }

    @Override
    public String getExampleInput() {
        return "KDE {Amarok}";
    }
}
