package de.assecutor.votianlt.model.task;

import com.vaadin.flow.component.UI;

public enum TaskType {
    CONFIRMATION("CONFIRMATION"),
    SIGNATURE("SIGNATURE"),
    TODOLIST("TODOLIST"),
    PHOTO("PHOTO"),
    BARCODE("BARCODE"),
    COMMENT("COMMENT");

    private final String translationKey;

    TaskType(String translationKey) {
        this.translationKey = translationKey;
    }

    public String getDisplayName() {
        // Fallback to German if UI not available
        try {
            if (UI.getCurrent() != null) {
                return UI.getCurrent().getTranslation("tasktype." + translationKey);
            }
        } catch (Exception e) {
            // Fallback to German if translation fails
        }

        // Fallback to German translations
        return switch (this) {
        case CONFIRMATION -> "Bestätigung";
        case SIGNATURE -> "Unterschrift";
        case TODOLIST -> "To-Do Liste";
        case PHOTO -> "Foto";
        case BARCODE -> "Barcode";
        case COMMENT -> "Kommentar";
        };
    }
}
