package com.engine.salary.enums.salarybill;

import com.engine.salary.enums.BaseEnum;

import java.util.Arrays;

/**
 * @ClassName BillConfimStatusEnum
 * @author Harryxzy
 * @date 2023/7/10 17:03
 * @description 工资单确认
 */
public enum BillConfimStatusEnum implements BaseEnum<Integer> {

    UNCONFIRMED(0, "未确认", 93286),
    CONFIRMED(1, "已确认", 93212),
    FEEDBACK(2, "已反馈", 0);

    private final int value;

    private final String defaultLabel;

    private final int labelId;

    BillConfimStatusEnum(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 "";
        }
        BillConfimStatusEnum[] enumAry = BillConfimStatusEnum.values();
        for(int i = 0; i < Arrays.asList(enumAry).size(); i++){
            if (enumAry[i].getValue().equals(value)) {
                return enumAry[i].getDefaultLabel();
            }
        }
        return "";
    }

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