import PocketBase from 'pocketbase'

export default defineNuxtPlugin(() => {
  const config = useRuntimeConfig()
  const pb = new PocketBase(config.public.pocketbaseUrl)

  // Restore auth state from cookie/localStorage (PocketBase does this automatically)
  // The store is persisted in localStorage by the PocketBase SDK

  return {
    provide: {
      pb,
    },
  }
})
