import { computed } from 'vue'
import { useAppStore } from '@/store'

export default function usePermissionCodes() {
  const appStore = useAppStore()
  const permissionCodes = computed(() => appStore.permissionCodes as string[])

  const hasPermission = (code: string) => permissionCodes.value.includes(code)

  return {
    permissionCodes,
    hasPermission,
  }
}
