package com.snack.server.module.file.enums;

import lombok.Getter;

/**
 * 文件业务类型
 */
@Getter
public enum FileBizTypeEnum {

    AVATAR("avatar", "用户头像"),
    ADMIN_AVATAR("admin-avatar", "管理员头像"),
    PRODUCT("product", "商品图"),
    SKU("sku", "SKU 规格图"),
    CATEGORY("category", "分类图标"),
    BANNER("banner", "轮播图"),
    NOTICE("notice", "公告封面"),
    CHAT("chat", "聊天图片"),
    COMMON("common", "通用");

    private final String code;
    private final String desc;

    FileBizTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static FileBizTypeEnum of(String code) {
        if (code == null) return COMMON;
        for (FileBizTypeEnum e : values()) {
            if (e.code.equalsIgnoreCase(code)) return e;
        }
        return COMMON;
    }
}
