package com.engine.salary.enums.datacollection;

import java.util.Arrays;

/**
 * @Description: 考勤引用-来源
 * @Author: wangxiangzhong
 * @Date: 2021-11-17 14:37
 */
public enum AttendQuoteFieldSourceTypeEnum {
    DEFAULT(1, "自定义", 87627),
    ATTEND(2, "考勤模块", 87626);

    private int value;

    private String defaultLabel;

    private int labelId;

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

    public int getValue() {
        return value;
    }

    public String getDefaultLabel() {
        return defaultLabel;
    }

    public int getLabelId() {
        return labelId;
    }

    public static String getDefaultLabelByValue(Integer value) {
        if (value == null) {
            return "";
        }
        AttendQuoteFieldSourceTypeEnum[] enumAry = AttendQuoteFieldSourceTypeEnum.values();
        for(int i = 0; i < Arrays.asList(enumAry).size(); i++){
            if (Integer.valueOf(enumAry[i].getValue()).equals(value)) {
                return enumAry[i].getDefaultLabel();
            }
        }
        return "";
    }

    public static String getNameByValue(Integer value) {
        if (value == null) {
            return "";
        }
        AttendQuoteFieldSourceTypeEnum[] enumAry = AttendQuoteFieldSourceTypeEnum.values();
        for(int i = 0; i < Arrays.asList(enumAry).size(); i++){
            if (Integer.valueOf(enumAry[i].getValue()).equals(value)) {
                return enumAry[i].name();
            }
        }
        return "";
    }
}
