package com.engine.salary.report.util;

import com.engine.salary.report.enums.DimensionEnum;
import com.engine.salary.report.enums.UnitTypeEnum;
import com.engine.salary.util.SalaryI18nUtil;

import java.util.*;


public class ReportEnumUtil {

    public static Map<Integer, String> unitTypeMap() {
        Map<Integer, String> unitTypeMap = new HashMap<>();
        Arrays.stream(UnitTypeEnum.values()).forEach(unitTypeEnum -> {
            unitTypeMap.put(unitTypeEnum.getValue(), SalaryI18nUtil.getI18nLabel(unitTypeEnum.getLabelId(), unitTypeEnum.getDefaultLabel()));
        });
        return unitTypeMap;
    }

    public static List<Map<String, String>> dimensionMap() {
        List<Map<String, String>> result = new ArrayList<>();
        Arrays.stream(DimensionEnum.values()).forEach(dimensionEnum -> {
            Map<String, String> dimensionMap = new HashMap<>();
            dimensionMap.put("id", dimensionEnum.getValue().toString());
            dimensionMap.put("content", SalaryI18nUtil.getI18nLabel(dimensionEnum.getLabelId(), dimensionEnum.getDefaultLabel()));
            result.add(dimensionMap);
        });
        return result;
    }

}
