import { defineStore } from "pinia";

interface ServerConfig {
  baseUrl: string;
  wssUrl: string | undefined;
}

export const useAppStore = defineStore("app", {
  state() {
    return {
      sceneId: "", // 分身场景id
      serverConfig: {
        // 服务器配置
        baseUrl: import.meta.env.VITE_API_BASE_URL, // 服务器基础地址
        wssUrl: import.meta.env.VITE_SOCKET_BASE_URL, // 服务器ws地址
      },
    };
  },
  getters: {},

  actions: {
    setSceneId(data: string) {
      this.sceneId = data;
    },
    setServerConfig(data: ServerConfig) {
      this.serverConfig = data;
    },
  },

  unistorage: true,
});
