/** Daftar email admin (comma-separated, lowercase). */
function adminEmails(): string[] {
  return (process.env.ADMIN_EMAILS ?? "")
    .split(",")
    .map((e) => e.trim().toLowerCase())
    .filter(Boolean);
}

export function isAdminEmail(email: string | null | undefined): boolean {
  if (!email) return false;
  return adminEmails().includes(email.toLowerCase());
}

/** Daftar email admin yang aman di-expose ke UI admin (dropdown filter). */
export function listAdminEmails(): string[] {
  return adminEmails();
}
