package com.engine.salary.enums.push;

import com.engine.salary.enums.BaseEnum;

import java.util.Arrays;
import java.util.Objects;

/**
 * 推送记录状态
 * <p>Copyright: Copyright (c) 2024</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public enum PushRecordTypeEnum implements BaseEnum<Integer> {
    PUSH(0, "推送", 85393),
    WITHDRAW(1, "撤回", 85393);

    private int value;

    private String defaultLabel;

    private int labelId;

    PushRecordTypeEnum(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 PushRecordTypeEnum parseByValue(int value) {
        for (PushRecordTypeEnum salaryDataSourceEnum : PushRecordTypeEnum.values()) {
            if (Objects.equals(salaryDataSourceEnum.getValue(), value)) {
                return salaryDataSourceEnum;
            }
        }
        return null;
    }

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