package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 用户状态枚举
 */
@Getter
@AllArgsConstructor
public enum UserStatusEnum {

    ENABLED("enabled", "启用"),
    DISABLED("disabled", "禁用");

    private final String code;
    private final String desc;

    public static UserStatusEnum getByCode(String code) {
        if (code == null) {
            return ENABLED;
        }
        for (UserStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return ENABLED;
    }
}
