package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 租户类型枚举
 */
@Getter
@AllArgsConstructor
public enum TenantTypeEnum {

    PLATFORM("platform", "平台"),
    LIBRARY("library", "图书馆"),
    KINDERGARTEN("kindergarten", "幼儿园"),
    SCHOOL("school", "学校"),
    INSTITUTION("institution", "机构"),
    OTHER("other", "其他");

    private final String code;
    private final String desc;

    public static TenantTypeEnum getByCode(String code) {
        if (code == null) {
            return OTHER;
        }
        for (TenantTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return OTHER;
    }
}
