package com.yuchen.saas.manage.system.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 功能相关
 */
@Getter
@AllArgsConstructor
public class NestBusinessOpenEnum {



    @Getter
    @AllArgsConstructor
    public enum StatusEnum {
        NOT_ENABLED(1, "未启用"),
        NORMAL(2, "正常"),
        PAUSED(3, "已暂停"),
        CLOSED(4, "已关闭"),

        EXPIRED(5, "已过期")
        ;

        private final int code;
        private final String desc;

        public static String getDescByCode(Integer code) {
            if (Objects.isNull(code)) {
                return null;
            }
            NestBusinessOpenEnum.StatusEnum[] enumArray = NestBusinessOpenEnum.StatusEnum.values();
            for (NestBusinessOpenEnum.StatusEnum e : enumArray) {
                if (e.getCode() == code) {
                    return e.getDesc();
                }
            }
            return "";
        }
    }


}