// src/lib/admin/overview-sections.ts — pure selection of which /admin
// overview sections a given SYS permission set is allowed to see. Extracted
// out of admin/page.tsx so the gating logic is unit-testable without a
// DB/session: an Admin SYS sees everything, a Staff SYS only sees the
// sections backed by a permission they actually hold (spec §6 — no error
// message, the section is simply omitted, consistent with the filtered nav).
import type { SysPermission } from "@/lib/auth/sys-permissions";

export interface AdminOverviewSections {
  users: boolean;
  orgs: boolean;
  billing: boolean;
  audit: boolean;
}

export function selectOverviewSections(
  perms: ReadonlySet<SysPermission>,
): AdminOverviewSections {
  return {
    users: perms.has("users:read"),
    orgs: perms.has("orgs:read"),
    billing: perms.has("billing:read"),
    audit: perms.has("audit:read"),
  };
}
