// The Lucia project.
// Copyright 2023-2026 DSP, inc.  All rights reserved.
// Authors:
//   chiayin.kuo@dsp.im (chiayin), 2023/1/31
//   imacat.yang@dsp.im (imacat), 2023/9/23
//   cindy.chang@dsp.im (Cindy Chang), 2024/5/30
/** @module stores/loading Global loading spinner state management. */

import { defineStore } from "pinia";

/** Pinia store for managing the global loading spinner visibility. */
export const useLoadingStore = defineStore("loadingStore", {
  state: () => ({
    /** Whether the loading spinner is currently visible. */
    isLoading: true,
  }),
  actions: {
    /**
     * Sets the loading spinner visibility.
     * @param {boolean} isLoadingBoolean - Whether to show the spinner.
     */
    setIsLoading(isLoadingBoolean) {
      this.isLoading = isLoadingBoolean;
    },
  },
});
