package com.sunyard.chsm.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author liulu
 * @since 2024/10/16
 */
@Getter
@AllArgsConstructor
public enum EnableStatus {

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

    private final String code;
    private final String desc;

    public static EnableStatus of(String code) {
        if (code == null || code.trim().isEmpty()) {
            return null;
        }

        return Arrays.stream(EnableStatus.values())
                .filter(it -> Objects.equals(it.code, code))
                .findFirst()
                .orElse(null);
    }



}
