import { defineStore } from 'pinia'
import type { PageAccess } from '@/types/menuAkses/access'

export const useHakAksesStore = defineStore('hakAksesMenu', {
  state: () => ({
    role: '',
    pageAccess: [] as PageAccess[],     //Array halaman dengan permissions
    mergedSidebar: []    
  }),

  actions: {
    setAccess(payload: { role: string; pages: PageAccess[] }) {
      this.role = payload.role
      this.pageAccess = payload.pages
    },

    resetAccess() {
      this.role = ''
      this.pageAccess = []
    },

     setMergedSidebar(data: any) {
      this.mergedSidebar = data
    }
  }
})


