package com.engine.salary.enums.salarybill;

import com.engine.salary.enums.BaseEnum;

import java.util.Arrays;

/**
 * 消息通道
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public enum MessageChannelEnum implements BaseEnum<Integer> {

    MSG(0, "系统消息", 93212),
    EMAIL(1, "邮件", 93286),
    SMS(2, "短信", 93287);

    private int value;

    private String defaultLabel;

    private int labelId;

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