import { MsgType } from '../core/mqtt/message/MsgType';
export class Utils {

    public static isHasContent(str: string | null | undefined): boolean {
        if (str == null) { // 这里的 == null 实际上会检查 null 和 undefined
            return false;
        }
        return str.trim() !== ''; // 使用trim()移除可能的空白字符
    }

    public static getTopicPrefix(msgType: MsgType): string {
        switch (msgType) {
            case MsgType.WILL:
            case MsgType.REPORT:
                return "/YMS/device/";
            case MsgType.CAST:
            case MsgType.DATA:
                return "/YMS/cast/";
            case MsgType.ACCOUNT:
            case MsgType.BIND_DEVICE:
                return "/YMS/account/";
            default:
                return "";
        }
    }
}