// useGettersStore.js
import { defineStore } from 'pinia';
import { useAppStore } from '@/store/api.js';
import { useUserStore } from '@/store/user.js';
import { usePermissionStore } from '@/store/permission.js';
import { useViewsStore } from '@/store/tagsView.js';

export const useGettersStore = defineStore('getters', {
  getters: {
    sidebar: (getters) => getters.app.sidebar,
    language: (getters) => getters.app.language,
    size: (getters) => getters.app.size,
    device: (getters) => getters.app.device,
    visitedViews: (getters) => getters.tagsView.visitedViews,
    cachedViews: (getters) => getters.tagsView.cachedViews,
    token: (getters) => getters.user.token,
    avatar: (getters) => getters.user.avatar,
    name: (getters) => getters.user.name,
    fraId: (getters) => getters.user.fraId,
    introduction: (getters) => getters.user.introduction,
    status: (getters) => getters.user.status,
    roles: (getters) => getters.user.roles,
    perms: (getters) => getters.user.perms,
    setting: (getters) => getters.user.setting,
    permissionRouters: (getters) => getters.permission.routers,
    addRouters: (getters) => getters.permission.addRouters,
  },
  actions: {
    get app() {
      return useAppStore();
    },
    get user() {
      return useUserStore();
    },
    get permission() {
      return usePermissionStore();
    },
    get tagsView() {
      return useViewsStore();
    },
  },
});