/**
 * vault-client — main package entry point
 * ─────────────────────────────────────────
 * All public exports. Import what you need:
 *
 * Core integration (MeyiConnect pattern):
 *   import { VaultProvider, VaultApp, vaultNavItems } from 'vault-client'
 *   import 'vault-client/style.css'
 *
 * Individual pages (if you manage routing yourself):
 *   import { VaultPage, EntriesPage } from 'vault-client'
 *
 * Hooks only (bring your own UI):
 *   import { useVaults, useEntries, useCreateGrant } from 'vault-client'
 *
 * Types:
 *   import type { Vault, VaultEntry, Grant } from 'vault-client'
 */

// ── Styles (emitted as dist/style.css) ────────────────────────────────────────
import './style.css'

// ── Provider — must wrap all vault UI ─────────────────────────────────────────
export { VaultProvider } from './context/VaultProvider'
export type { VaultProviderProps } from './context/VaultProvider'

// ── Complete self-contained app ───────────────────────────────────────────────
export { VaultApp } from './VaultApp'

// ── Individual pages (host manages routing) ───────────────────────────────────
export { VaultPage } from './pages/VaultPage'
export { EntriesPage } from './pages/EntriesPage'

// ── Dialogs (compose your own UI) ─────────────────────────────────────────────
export {
  VaultCreateDialog,
  EntryFormDialog,
  GrantAccessDialog,
  ConfirmDialog,
} from './components/dialogs'

// ── React Query hooks (full control) ─────────────────────────────────────────
export {
  useVaults,
  useCreateVault,
  useUpdateVault,
  useDeleteVault,
  useEntries,
  useCreateEntry,
  useUpdateEntry,
  useDeleteEntry,
  useGrants,
  useCreateGrant,
  useRevokeGrant,
  useVaultStats,
  vaultKeys,
} from './hooks/useVault'

// ── Types ─────────────────────────────────────────────────────────────────────
export type {
  Vault,
  VaultEntry,
  Grant,
  ExpiresIn,
} from './services/api'

// ── Sidebar nav items for MeyiConnect sidebar-data.ts ────────────────────────
// Usage: import { vaultNavItems } from 'vault-client'
//        then spread into navGroups in sidebar-data.ts
export const vaultNavItems = [
  {
    title: 'Vaults',
    url: '/vault',
    icon: 'FolderLock',
    roles: ['admin', 'user'],
    plugin: 'vault',
  },
  {
    title: 'Audit',
    url: '/vault/audit',
    icon: 'ScrollText',
    roles: ['admin'],
    plugin: 'vault',
  },
] as const

// ── Plugin metadata (used by MeyiConnect plugin registry) ────────────────────
export const vaultPluginMeta = {
  name: 'vault',
  displayName: 'Password Vault',
  description: 'Self-hosted AES-256-GCM encrypted team password manager',
  version: '1.0.0',
  icon: 'FolderLock',
  author: 'Meyi Technologies',
  requires: {
    server: 'vault-server',
    minServerVersion: '1.0.0',
  },
}
