// Slugs of canonical built-in apps whose route is owned by the system
// and must not be changed by an admin. Two flavors qualify:
//   1. Slugs whose `route` is hardcoded in the tx-os SPA router
//      (see artifacts/tx-os/src/App.tsx). Renaming the route breaks
//      navigation silently — the launcher would set the new path but
//      no <Route> matches.
//   2. Slugs that are part of the seeded product surface (e.g.
//      "calendar", "documents") even when their route is not hardcoded
//      in the SPA today. Locking them keeps the seeded path stable so
//      links, deep-links, audits, and future hardcoded routes stay in
//      sync with the seed contract.
// server rejects route AND slug changes for these slugs and
// the admin form locks both fields. Add a slug here whenever you wire
// a new hardcoded <Route> in App.tsx OR seed a new canonical app.
//
// IMPORTANT: This file has zero imports on purpose so it can be
// consumed safely from both the API server (Node, via @workspace/db)
// and the tx-os browser bundle (via @workspace/db/built-in-apps,
// which avoids pulling in `pg`).
export const BUILTIN_APP_SLUGS = [
  "services",
  "notifications",
  "admin",
  "notes",
  "my-orders",
  "orders-incoming",
  "executive-meetings",
  "calendar",
  "documents",
] as const;

export type BuiltinAppSlug = (typeof BUILTIN_APP_SLUGS)[number];

export function isBuiltinAppSlug(slug: string): slug is BuiltinAppSlug {
  return (BUILTIN_APP_SLUGS as readonly string[]).includes(slug);
}
