import { useRtcStore } from "/@/store/modules/rtc";
import type { ChatContentType } from "/@/store/modules/rtc";

interface ActionDataType {
    type: string;
    data: any
}

export function handleActions(data: ActionDataType) {
    switch (data.type) {
        case 'user-init':
            break;
        case 'danmumsg':
            handleDanMumSg(data.data)
            break;

        case "changeScene":
            break;

        case 'user-join':
            break;
        case "user-leave":
            break;

        case "users-words":
            break;
        case "leader-dismiss":
            break;

        case 'tagclick':
            break;
        case 'tagclose':
            break;
        case 'tag-image-index':
            break;

        case 'ask-currentscene':
            break;

        case 'changeScene':
            break;
        default:
            break;
    }

}

// 处理弹幕
function handleDanMumSg(data: ChatContentType) {
    const rtcStore = useRtcStore();
    if (data.role == "leader") {
        data.Nickname = "主持人";
    }
    rtcStore.addToChatList(data)
}