import { getActiveRole } from "@/lib/session-context";
import { getStoredUser } from "@/lib/api";

const TEACHER_ROLES = new Set(["teacher", "guest_teacher"]);

export function isTeacherRole(): boolean {
  const active = getActiveRole();
  if (active && TEACHER_ROLES.has(active)) return true;
  const user = getStoredUser<{ roles?: string[] }>();
  return (user?.roles ?? []).some((r) => TEACHER_ROLES.has(r));
}
