package com.engine.salary.enums.salarybill;

import com.engine.salary.enums.BaseEnum;

import java.util.Arrays;

/**
 * @ClassName BillReadStatusEnum
 * @author Harryxzy
 * @date 2023/7/10 17:13
 * @description 工资单查看
 */
public enum BillReadStatusEnum implements BaseEnum<Integer> {

    UNREAD(0, "未查看", 93286),
    READED(1, "已查看", 93212);

    private int value;

    private String defaultLabel;

    private int labelId;

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

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getDefaultLabel() {
        return defaultLabel;
    }

    @Override
    public Integer getLabelId() {
        return labelId;
    }

    public static String getDefaultLabelByValue(Integer value) {
        if (value == null) {
            return "";
        }
        BillReadStatusEnum[] enumAry = BillReadStatusEnum.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 "";
        }
        BillReadStatusEnum[] enumAry = BillReadStatusEnum.values();
        for(int i = 0; i < Arrays.asList(enumAry).size(); i++){
            if (Integer.valueOf(enumAry[i].getValue()).equals(value)) {
                return enumAry[i].name();
            }
        }
        return "";
    }
}
