package com.engine.salary.report.enums;

import com.engine.salary.enums.BaseEnum;
import com.engine.salary.util.SalaryI18nUtil;

import java.util.Arrays;
import java.util.Optional;

/**
 * 薪酬统计维度类型
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public enum SalaryStatisticsDimensionTypeEnum implements BaseEnum<String> {
    QUALITATIVE("QUALITATIVE", "定性", 161086),
    RATION_GROUP_SPACING("RATION_GROUP_SPACING", "定量-组距式分组", 161087),
    RATION_GROUP_INDIVIDUAL("RATION_GROUP_INDIVIDUAL", "定量-单项式分组", 161088);

    private String value;

    private String defaultLabel;

    private int labelId;

    SalaryStatisticsDimensionTypeEnum(String value, String defaultLabel, int labelId) {
        this.value = value;
        this.defaultLabel = defaultLabel;
        this.labelId = labelId;
    }

    public String getValue() {
        return value;
    }

    public String getDefaultLabel() {
        return defaultLabel;
    }

    public Integer getLabelId() {
        return labelId;
    }

    public static String getDefaultLabelByValue(String value) {
        Optional<SalaryStatisticsDimensionTypeEnum> optionalDimensionType = Arrays.stream(SalaryStatisticsDimensionTypeEnum.values()).filter(r -> r.getValue().equals(value)).findFirst();
        return optionalDimensionType.isPresent() ? SalaryI18nUtil.getI18nLabel( optionalDimensionType.get().getLabelId(), optionalDimensionType.get().getDefaultLabel()) : "";
    }
}
