import type { WebUserSession } from "../../types";

const REVIEW_ROLES = new Set(["admin", "staff", "reviewer", "moderator"]);

function getRole(session: WebUserSession | null): string {
  return String(session?.user.role || "").toLowerCase();
}

export function canReviewCommunity(session: WebUserSession | null): boolean {
  return REVIEW_ROLES.has(getRole(session));
}

export function canManageCommunityCases(session: WebUserSession | null): boolean {
  return getRole(session) === "admin";
}
