package com.ruoyi.common.constant;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

public class TrainingScoreConstants {
    public static final int DATA_COLLECTION_STEP_DESCRIPTION = 3;
    public static final int DATA_COLLECTION_TOOLBAR_BUTTON = 2;

    public static final int TEXT_SEGMENTATION_STEP_DESCRIPTION = 3;
    public static final int TEXT_SEGMENTATION_TOOLBAR_BUTTON = 3;
    public static final int TEXT_SEGMENTATION_ANALYSIS_TRAIN_BUTTON = 4;

    public static final int PARTOFSPEECH_TAGGING_STEP_DESCRIPTION = 3;
    public static final int PARTOFSPEECH_TAGGING_TOOLBAR_BUTTON = 3;
    public static final int PARTOFSPEECH_TAGGING_ANALYSIS_TRAIN_BUTTON = 4;

    public static final int CATEGORY_MANAGEMENT_STEP_DESCRIPTION = 3;
    public static final int CATEGORY_MANAGEMENT_ADD_BUTTON = 2;

    public static final int TEXT_CLASSIFICATION_STEP_DESCRIPTION = 3;
    public static final int TEXT_CLASSIFICATION_ARTICLE_CLASSIFICATION_BUTTON = 3;
    public static final int TEXT_CLASSIFICATION_CREATE_ARTICLE_BUTTON = 3;
    public static final int TEXT_CLASSIFICATION_TOOLBAR_DETAILS_BUTTON = 3;


    public static final int TEXT_SUMMARIZATION_STEP_DESCRIPTION = 3;
    public static final int TEXT_SUMMARIZATION_ARTICLE_SUMMARY_BUTTON = 3;
    public static final int TEXT_SUMMARIZATION_CREATE_ARTICLE_BUTTON = 3;
    public static final int TEXT_SUMMARIZATION_TOOLBAR_DETAILS_BUTTON = 3;

    public static final int SIMILARITY_CALCULATION_STEP_DESCRIPTION = 3;
    public static final int SIMILARITY_CALCULATION_ADD_BUTTON_TOP = 3;
    public static final int SIMILARITY_CALCULATION_ADD_BUTTON_BOTTOM = 3;
    public static final int SIMILARITY_CALCULATION_CALCULATE_SIMILARITY_BUTTON = 3;

    public static final int SENTIMENT_ANALYSIS_STEP_DESCRIPTION = 3;
    public static final int SENTIMENT_ANALYSIS_SELECT_BUTTON = 3;
    public static final int SENTIMENT_ANALYSIS_SENTIMENT_ANALYSIS_BUTTON = 3;
    public static final int SENTIMENT_ANALYSIS_CREATE_SENTIMENT_WORD_BUTTON = 3;

    public static final int DATA_VISUALIZATION_STEP_DESCRIPTION = 3;
    public static final int DATA_VISUALIZATION_WORD_CLOUD_BUTTON = 3;
    public static final int DATA_VISUALIZATION_SOCIAL_NETWORK_ANALYSIS_BUTTON = 3;
    public static final int DATA_VISUALIZATION_SENTIMENT_ANALYSIS_BUTTON = 3;

    public static final int REPORT_SUBMISSION_EXPERIENCE_PAGE_SAVE_BUTTON = 3;
    public static final int REPORT_SUBMISSION_UPLOAD_REPORT_BUTTON = 4;
    public static final int REPORT_SUBMISSION_SUBMIT_BUTTON = 3;

    public static Map<String, Integer> getTrainingScoreConstantsMap() {
        Map<String, Integer> constantsMap = new HashMap<>();

        try {
            // 获取TrainingScoreConstants类中的所有字段
            Field[] fields = TrainingScoreConstants.class.getDeclaredFields();

            // 遍历字段
            for (Field field : fields) {
                // 判断字段是否为静态字段
                if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
                    // 将字段名和字段值放入map中
                    constantsMap.put(convertToCamelCase(field.getName()), field.getInt(null));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return constantsMap;
    }

    public static String convertToCamelCase(String string) {
        // 拆分字符串为单词数组
        String[] words = string.split("_");

        // 将单词转换为小写，并将首字母大写
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < words.length; i++) {
            String word = words[i].toLowerCase();
            if (i > 0) {
                // 将首字母大写
                word = Character.toUpperCase(word.charAt(0)) + word.substring(1);
            }
            sb.append(word);
        }

        return sb.toString();
    }
}
