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

import lombok.Getter;

/**
 * 客服消息类型
 */
@Getter
public enum ChatMessageTypeEnum {

    TEXT("text", "文本"),
    IMAGE("image", "图片"),
    FILE("file", "文件"),
    PRODUCT("product", "商品卡片"),
    SYSTEM("system", "系统");

    private final String code;
    private final String desc;

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

    public static ChatMessageTypeEnum of(String code) {
        if (code == null) return null;
        for (ChatMessageTypeEnum v : values()) {
            if (v.code.equalsIgnoreCase(code)) return v;
        }
        return null;
    }
}
