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 PushRecordDetailStatusEnum implements BaseEnum<Integer> {
    PREPARE(0, "待推送", 87625),
    SUCCESS(1, "推送成功", 85393),
    FAIL(2, "推送失败", 85393),
    WITHDRAW_SUCCESS(3, "已撤回", 85393),
    WITHDRAW_FAIL(4, "撤回失败", 85393);

    private int value;

    private String defaultLabel;

    private int labelId;

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

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