package cn.hanghui.outapi.platform.tenant.entity.enums;

import cn.hanghui.outapi.platform.common.utils.Preconditions;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author shisl
 * @package cn.hanghui.outapi.platform.tenant.entity.enums
 * @class AccountTypeEnum
 * @date 2024/7/1 下午2:26
 * @description 账号类型
 */
@Getter
@AllArgsConstructor
public enum AccountTypeEnum {

    ADMIN(0, "超级管理员"),
    COMMON(1, "普通账号"),
    AUTH(2, "授权账号");

    private Integer code;
    private String desc;

    public static AccountTypeEnum findByCode(Integer code) {
        if (Preconditions.isBlank(code)) {
            return null;
        }
        for (AccountTypeEnum enumObject : values()) {
            if (enumObject.code == code.intValue()) {
                return enumObject;
            }
        }
        return null;
    }

}
