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

import lombok.Getter;

/**
 * 客服会话状态
 *
 * - WAITING(0): 待处理（用户发起，尚未分配客服）
 * - PROCESSING(1): 处理中（已分配客服，正在对话）
 * - RESOLVED(2): 已解决
 * - CLOSED(3): 已关闭
 */
@Getter
public enum ChatSessionStatusEnum {

    WAITING(0, "待处理"),
    PROCESSING(1, "处理中"),
    RESOLVED(2, "已解决"),
    CLOSED(3, "已关闭");

    private final Integer code;
    private final String desc;

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

    public static ChatSessionStatusEnum of(Integer code) {
        if (code == null) return null;
        for (ChatSessionStatusEnum v : values()) {
            if (v.code.equals(code)) return v;
        }
        return null;
    }
}
