import { defineStore } from 'pinia'

export const useRoomStore = defineStore('room', {
    state: () => ({
        sessionId: '',
        roomId: '',
        bizName: '',
        subBiz: '',
        sign: '',
        userId: '',
        token: '',
        mrtcService: null,
    }),
    actions: {
        setRoomInfo(info) {
            this.sessionId = info?.sessionId||''
            this.roomId = info?.roomId||''
            this.bizName = info?.bizName||''
            this.subBiz = info?.subBiz||''
            this.sign = info?.sign||''
            this.userId = info?.userId||''
            this.token = info?.token||''
        },
        setSessionId(sessionId) {
            this.sessionId = sessionId
        },
        setRoomId(roomId) {
            this.roomId = roomId
        },
        setBizName(bizName) {
            this.bizName = bizName
        },
        setSubName(subBiz) {
            this.subBiz = subBiz
        },
        setSign(sign) {
            this.sign = sign
        },
        setUserId(userId) {
            this.userId = userId
        },
        setToken(token) {
            this.token = token
        },
        setMrtcService(mrtcService) {
            this.mrtcService = mrtcService
        },
        reset() {
            this.$reset()
        },
    },
    persist: true
},)
