export const useAppStore = defineStore('app', () => {
  const data = reactive<any>({
    musicList: [],
    classList: [],
    socketTrain: null,
    socketHand: null
  });
  const { musicList, classList, socketTrain, socketHand } = toRefs(data);

  /**
   * 获取音乐
   */
  const getMusic = () => {
    return musicList.value;
  };

  /**
   * 设置音乐
   */
  const setMusic = (data: any) => {
    musicList.value = data;
  };

  /**
   * 获取班级
   */
  const getClass = () => {
    return classList.value;
  };

  /**
   * 设置班级
   */
  const setClass = (data: any) => {
    classList.value = data;
  };

  /**
   * 获取测试WS
   */
  const getSocketTrain = () => {
    return socketTrain.value;
  };

  /**
   * 设置测试WS
   */
  const setSocketTrain = (data: any) => {
    socketTrain.value = data;
  };

  /**
   * 获取手势WS
   */
  const getSocketHand = () => {
    return socketHand.value;
  };

  /**
   * 设置手势WS
   */
  const setSocketHand = (data: any) => {
    socketHand.value = data;
  };

  return {
    getMusic,
    setMusic,
    getClass,
    setClass,
    getSocketTrain,
    setSocketTrain,
    getSocketHand,
    setSocketHand,
  };
});

export default useAppStore;
