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 IsAuthorizeEnum implements IntArrayValuable {
    UNAUTHORIZED(0, "未授权"),
    AUTHORIZED(1, "已授权"),
    AUTHORIZED_EXIST(1, "已开通退出登录")
    ;

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

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

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

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