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/29
 * @Description: 用户类型
 */
@AllArgsConstructor
@Getter
public enum AccountTypeEnum implements IntArrayValuable {
    PHONE_NUMBER(1, "手机号"),
    EMAIL(2, "邮箱"),
    COMMUNICATION_CERTIFICATE(3, "通信证");

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

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

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

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