package cn.sikey.mcdisk.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.sikey.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @Author: nelson
 * @Date: 2025/5/30
 * @Description: 邀请渠道
 */
@AllArgsConstructor
@Getter
public enum ChannelTypeEnum implements IntArrayValuable {
    WE_CHAT(2, "微信"),
    QQ(4, "QQ"),
    QRCODE(5, "二维码");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ChannelTypeEnum::getValue).toArray();

    /**
     * value
     */
    private final Integer value;
    /**
     * name
     */
    private final String name;

    public static ChannelTypeEnum valueOf(Integer value) {
        return ArrayUtil.firstMatch(channelTypeEnum -> channelTypeEnum.getValue().equals(value), ChannelTypeEnum.values());
    }

    @Override
    public int[] array() {
        return ARRAYS;
    }
}
