package cn.sikey.mcdisk.enums;

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

import java.util.Arrays;

/**
 * @Author: nelson
 * @Date: 2025/5/29
 * @Description: 状态码
 */
public enum CodeStatusEnum implements IntArrayValuable {


    // WATCH_HAS_NOT_BEEN_AUTHENTICATED(1001, "手表还未认证授权"),

    USER_HAS_NOT_BEEN_AUTHENTICATED(1002, "用户还未认证授权"),

    USER_HAS_BEEN_AUTHENTICATED(1003, "用户已认证授权"),

    // PHOTO_HAS_BEEN_UNAUTHORIZED(0, "未授权"),

    // PHOTO_HAS_BEEN_AUTHENTICATED(1, "已授权"),

     NOT_ACTIVATED(0, "未开通"),

    // ALREADY_ACTIVATED(1, "已开通"),

    LOG_OUT(2, "退出登录"),
    ;


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

    public static CodeStatusEnum valueOf(Integer code) {
        return ArrayUtil.firstMatch(c -> c.getCode().equals(code), CodeStatusEnum.values());
    }

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

    private final Integer code;

    private final String description;

    CodeStatusEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }


    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
